Class: Ruby::Pomodoro::Cmd::Pause

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby/pomodoro/cmd/pause.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from TimeHelpers

#to_format_string

Constructor Details

This class inherits a constructor from Ruby::Pomodoro::Cmd::Base

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ruby/pomodoro/cmd/pause.rb', line 5

def call
  if worker.working?
    Main.new.call
    worker.pause
    choices = [
      { key: 'y', name: "Resume this task", value: true },
      { key: 'n', name: 'Stop this task', value: false },
    ]
    print text: "#{worker.current_task.name} was paused\n", color: :yellow, clear: false
    if prompt.expand("Resume?", choices)
      Main.new.call
      worker.resume
    else
      Stop.new.call
    end
  else
    Main.new.call
  end
end