Class: Pomodoro::Commands::Fail

Inherits:
Command
  • Object
show all
Defined in:
lib/pomodoro/commands/fail.rb

Overview

1/5/2018: specs complete, help complete.

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Pomodoro::Commands::Command

Instance Method Details

#runObject


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pomodoro/commands/fail.rb', line 9

def run
  ensure_today

  if with_active_task(self.config) do |active_task|
        print "#{t(:prompt_why)} "
        reason = $stdin.readline.chomp

        active_task.fail!(reason)
        puts t(:success, task: Pomodoro::Tools.unsentence(active_task.body))
     end
  else
    abort t(:no_task_in_progress)
  end
end