class TomatoPaste::Cli
Public Class Methods
new(input = $stdin, output = $stdout)
click to toggle source
# File lib/tomato_paste/cli.rb, line 11 def initialize(input = $stdin, output = $stdout) @input = input @output = output @vine = TomatoPaste::Vine.new end
Public Instance Methods
run()
click to toggle source
# File lib/tomato_paste/cli.rb, line 17 def run @output.print ascii_banner task_loop @output.print "\n\nBye!" end
task_loop(big_break_duration=1200)
click to toggle source
# File lib/tomato_paste/cli.rb, line 39 def task_loop(big_break_duration=1200) # 20 minutes begin @output.print "\n\n" @output.print "Task Description: " task_description = @input.gets.chomp @vine.add(TomatoPaste::Pomodoro.new(task_description)) @output.puts emit_notification "Starting Pomodoro ##{@vine.pomodori.count}" @vine.current_pomodoro.work_timer.start TomatoPaste::Notification.play_audio_alert if @vine.big_break_time? emit_notification "It's time for a big break. Come back in 20 minutes." Timer.new(big_break_duration).start else emit_notification "Pomodoro ##{@vine.pomodori.count} complete. Break starts now!" @vine.current_pomodoro.break_timer.start end TomatoPaste::Notification.play_audio_alert emit_notification "Break done!" @output.print "\nDo another Pomodoro? (Y/N): " end while @input.gets.upcase.chomp != "N" end
Private Instance Methods
emit_notification(message)
click to toggle source
# File lib/tomato_paste/cli.rb, line 71 def emit_notification(message) @output.puts message TomatoPaste::Notification.display_visual_alert(message) end