Module: Ruby::Pomodoro

Defined in:
lib/ruby/pomodoro.rb,
lib/ruby/pomodoro/task.rb,
lib/ruby/pomodoro/worker.rb,
lib/ruby/pomodoro/printer.rb,
lib/ruby/pomodoro/version.rb,
lib/ruby/pomodoro/cmd/base.rb,
lib/ruby/pomodoro/cmd/main.rb,
lib/ruby/pomodoro/cmd/quit.rb,
lib/ruby/pomodoro/cmd/stop.rb,
lib/ruby/pomodoro/cmd/pause.rb,
lib/ruby/pomodoro/progressbar.rb,
lib/ruby/pomodoro/notification.rb,
lib/ruby/pomodoro/tasks/editor.rb,
lib/ruby/pomodoro/tasks/entity.rb,
lib/ruby/pomodoro/time_helpers.rb,
lib/ruby/pomodoro/cmd/edit_list.rb,
lib/ruby/pomodoro/tasks/resource.rb,
lib/ruby/pomodoro/time_converter.rb,
lib/ruby/pomodoro/cmd/choose_task.rb,
lib/ruby/pomodoro/cmd/error_handler.rb,
lib/ruby/pomodoro/command_controller.rb,
lib/ruby/pomodoro/notification_observer.rb,
lib/ruby/pomodoro/terminal_notifier_channel.rb

Defined Under Namespace

Modules: Cmd, CommandController, Tasks, TerminalNotifierChannel, TimeConverter, TimeHelpers Classes: Error, Notification, NotificationObserver, Printer, Progressbar, Task, Worker

Constant Summary collapse

REPEAT_ALERT_TIME =
60 * 5
POMODORO_SIZE =
60 * 30
VERSION =
"0.4.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.editorObject (readonly)

Returns the value of attribute editor.



40
41
42
# File 'lib/ruby/pomodoro.rb', line 40

def editor
  @editor
end

.tasks_file_pathObject (readonly)

Returns the value of attribute tasks_file_path.



40
41
42
# File 'lib/ruby/pomodoro.rb', line 40

def tasks_file_path
  @tasks_file_path
end

Class Method Details

.startObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ruby/pomodoro.rb', line 42

def start
  Worker.instance.then do |worker|
    add_observer(worker)
    worker.pomodoro_size = POMODORO_SIZE
  end

  @tasks_file_path = File.join(init_app_folder, "tasks")

  @editor = Tasks::Editor.new(file_path: tasks_file_path)
  editor.load
  Cmd::Main.new.call
  reader = TTY::Reader.new
  reader.subscribe(CommandController)
  loop do
    reader.read_char
  rescue => e
    Cmd::ErrorHandler.new.call(e)
  end
end