class Pompom::Application
Attributes
worklog[R]
Public Class Methods
new(options)
click to toggle source
# File lib/pompom.rb, line 16 def initialize(options) @options = options if options[:no_log] @worklog = NullWorkLog.new else @worklog = Worklog.new(options[:log]) end end
Public Instance Methods
cleanup()
click to toggle source
# File lib/pompom.rb, line 33 def cleanup @worklog.finish_early end
run()
click to toggle source
# File lib/pompom.rb, line 25 def run new_pomodoro do |pomodoro| @worklog.start pomodoro pomodoro.tick until pomodoro.finished? end play_sound end
Private Instance Methods
new_pomodoro() { |pomodoro| ... }
click to toggle source
# File lib/pompom.rb, line 49 def new_pomodoro pomodoro = Pomodoro.new(@options[:time], @options[:message]) view = View.new(NCursesScreen.new) pomodoro.add_observer(view) view.run { yield pomodoro } end
play_sound()
click to toggle source
There has to be a better way of playing sounds through ruby… This will only work if you have sox installed (or a command named /usr/bin/play) and a sound named sound.wav in your ~/.pompom directory.
# File lib/pompom.rb, line 43 def play_sound if File.exists?(File.expand_path("~/.pompom/sound.wav")) && File.exists?("/usr/bin/play") `play -q ~/.pompom/sound.wav` end end