Class: MM::Console::SimpleCommand::ToDo
- Inherits:
-
Object
- Object
- MM::Console::SimpleCommand::ToDo
- Includes:
- Base
- Defined in:
- lib/mm/console/simple_command/todo.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
- #execute(runtime) ⇒ Object
-
#initialize(todo = '') ⇒ ToDo
constructor
A new instance of ToDo.
- #todo_list(runtime) ⇒ Object
Methods included from Base
Constructor Details
#initialize(todo = '') ⇒ ToDo
Returns a new instance of ToDo.
73 74 75 |
# File 'lib/mm/console/simple_command/todo.rb', line 73 def initialize(todo='') @todo = todo.gsub(/^todo/, '').strip end |
Class Method Details
.doc(runtime) ⇒ Object
69 70 71 |
# File 'lib/mm/console/simple_command/todo.rb', line 69 def self.doc(runtime) "manage your todo list based on context" end |
.keys ⇒ Object
66 67 68 |
# File 'lib/mm/console/simple_command/todo.rb', line 66 def self.keys ['todo( (.+))?'] end |
Instance Method Details
#execute(runtime) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/mm/console/simple_command/todo.rb', line 77 def execute(runtime) unless @todo.blank? todo_list(runtime).unshift Task.new(@todo) end runtime[:list] = todo_list(runtime) end |
#todo_list(runtime) ⇒ Object
84 85 86 |
# File 'lib/mm/console/simple_command/todo.rb', line 84 def todo_list(runtime) runtime[:todo] ||= SelectingList.new([], Event) end |