Class: Commands::AddCommand
- Inherits:
-
Object
- Object
- Commands::AddCommand
- Defined in:
- lib/commands/addcommand.rb
Instance Method Summary collapse
- #help(commandcontext) ⇒ Object
-
#initialize(tracker) ⇒ AddCommand
constructor
A new instance of AddCommand.
- #run(commandcontext) ⇒ Object
Constructor Details
#initialize(tracker) ⇒ AddCommand
Returns a new instance of AddCommand.
8 9 10 |
# File 'lib/commands/addcommand.rb', line 8 def initialize(tracker) @tracker = tracker end |
Instance Method Details
#help(commandcontext) ⇒ Object
21 22 23 |
# File 'lib/commands/addcommand.rb', line 21 def help(commandcontext) commandcontext.output 'Use pug add <type of report> <initial status>' end |
#run(commandcontext) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/commands/addcommand.rb', line 12 def run(commandcontext) type = commandcontext.pop_command! 'Missing type' status = commandcontext.pop_command! 'Missing status' title = commandcontext.prompt "Enter a title" @tracker.add(type, status, title) end |