class Ruby::Pomodoro::NotificationObserver
Public Class Methods
new(stop:, pause:, time:, printer: Printer.new)
click to toggle source
@param stop [Ruby::Pomodoro::Notification] @param pause [Ruby::Pomodoro::Notification] @param time [Numeric] repeat notifications interval in seconds
# File lib/ruby/pomodoro/notification_observer.rb, line 7 def initialize(stop:, pause:, time:, printer: Printer.new) @stop_notification = stop @pause_notification = pause @time = time @printer = printer end
Public Instance Methods
update(event)
click to toggle source
@param [Symbol] event
# File lib/ruby/pomodoro/notification_observer.rb, line 15 def update(event) case event when :finish @stop_notification.notify(@time) @printer.print_line "_Task #{Worker.instance.current_task.name} was stopped, type [\u21e7 + R] for resume\r", color: :red when :pause @pause_notification.notify(@time, skip_now: true) when :stop, :start @pause_notification.stop @stop_notification.stop else @pause_notification.stop end end