Class: Todo
- Inherits:
-
Object
- Object
- Todo
- Defined in:
- lib/todo.rb
Instance Method Summary collapse
-
#initialize(cmd, arg) ⇒ Todo
constructor
A new instance of Todo.
- #start ⇒ Object
Constructor Details
#initialize(cmd, arg) ⇒ Todo
Returns a new instance of Todo.
2 3 4 5 |
# File 'lib/todo.rb', line 2 def initialize (cmd, arg) @cmd = cmd @arg = arg end |
Instance Method Details
#start ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/todo.rb', line 7 def start case @cmd when nil, "help", "h", "?" help when "status", "show", "s" show when "delete", "del", "d" delete when "add", "a", "+" error(:task) if @arg.nil? add(@arg) when "remove", "rm", "r", "-" error(:task) if @arg.nil? remove(@arg) when "check", "c" error(:task) if @arg.nil? check(@arg) when "uncheck", "uc" error(:task) if @arg.nil? uncheck(@arg) else error(:cmd) end end |