Class: Pompom::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/pompom.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Application

Returns a new instance of Application.



16
17
18
19
20
21
22
23
# 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

Instance Attribute Details

#worklogObject (readonly)

Returns the value of attribute worklog.



14
15
16
# File 'lib/pompom.rb', line 14

def worklog
  @worklog
end

Instance Method Details

#cleanupObject



33
34
35
# File 'lib/pompom.rb', line 33

def cleanup
  @worklog.finish_early
end

#runObject



25
26
27
28
29
30
31
# File 'lib/pompom.rb', line 25

def run
  new_pomodoro do |pomodoro|
    @worklog.start pomodoro
    pomodoro.tick until pomodoro.finished?
  end
  play_sound
end