module TaskManager
Constants
- VERSION
Public Class Methods
add(name, score = 0)
click to toggle source
# File lib/task_manager.rb, line 17 def self.add(name, score = 0) task = NewTaskFile.new.add(Task.new(name, score)) print('Added new task:'.colorize(:light_cyan)) print_task(task) end
current()
click to toggle source
# File lib/task_manager.rb, line 50 def self.current task = CurrentTaskFile.new.current print('Current task:'.colorize(:light_cyan)) print_task(task) rescue Exception => e print e.message end
delete(id)
click to toggle source
# File lib/task_manager.rb, line 42 def self.delete(id) task = NewTaskFile.new.delete(id) print('Deleted task:'.colorize(:light_cyan)) print_task(task) rescue Exception => e print e.message end
finish()
click to toggle source
# File lib/task_manager.rb, line 58 def self.finish task = CurrentTaskFile.new.pick DoneTaskFile.new.add(task) print('Finished task:'.colorize(:light_green)) print_task(task) rescue Exception => e print e.message end
finish_with_id(id)
click to toggle source
# File lib/task_manager.rb, line 67 def self.finish_with_id(id) task = NewTaskFile.new.pick(id) do |task| DoneTaskFile.new.add(task) end print('Finished task:'.colorize(:light_green)) print_task(task) rescue Exception => e print e.message end
pick(id)
click to toggle source
# File lib/task_manager.rb, line 23 def self.pick(id) task = NewTaskFile.new.pick(id) do |task| CurrentTaskFile.new.add(task) end print('Picked task:'.colorize(:light_cyan)) print_task(task) rescue Exception => e print e.message end
stats()
click to toggle source
# File lib/task_manager.rb, line 77 def self.stats print('Waiting tasks:'.colorize(:light_cyan)) NewTaskFile.new.all.each do |task| print_task(task) end print('') print('Current task:'.colorize(:light_cyan)) CurrentTaskFile.new.all.each do |task| print_task(task) end print('') print('Done tasks:'.colorize(:light_cyan)) DoneTaskFile.new.all.each do |task| print_task(task) end end
undo()
click to toggle source
# File lib/task_manager.rb, line 33 def self.undo task = CurrentTaskFile.new.pick NewTaskFile.new.add(task) print('Undid task:'.colorize(:light_cyan)) print_task(task) rescue Exception => e print e.message end
Private Class Methods
print(sentence)
click to toggle source
# File lib/task_manager.rb, line 98 def self.print(sentence) $stdout.puts sentence end
print_task(task)
click to toggle source
# File lib/task_manager.rb, line 102 def self.print_task(task) Format.new(task).print_output end