Class: Pomodoro::Commands::Next

Inherits:
Command
  • Object
show all
Defined in:
lib/pomodoro/commands/next.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
23
# File 'lib/pomodoro/commands/next.rb', line 9

def run
  ensure_today

  with_active_task(self.config) do |active_task|
    warn "#{t(:task_in_progress, task: Pomodoro::Tools.unsentence(active_task.body))}\n\n"
  end

  time_frame(self.config) do |day, current_time_frame|
    if next_task = current_time_frame.first_unstarted_task
      puts t(:upcoming_task, task: Pomodoro::Tools.unsentence(next_task.body))
    else
      abort t(:no_more_tasks_in_time_frame, time_frame: current_time_frame.name)
    end
  end
end