Class: Commands::ListCommand
- Inherits:
-
Object
- Object
- Commands::ListCommand
- Defined in:
- lib/commands/listcommand.rb
Instance Method Summary collapse
- #help(commandcontext) ⇒ Object
-
#initialize(tracker) ⇒ ListCommand
constructor
A new instance of ListCommand.
- #run(commandcontext) ⇒ Object
Constructor Details
#initialize(tracker) ⇒ ListCommand
Returns a new instance of ListCommand.
9 10 11 |
# File 'lib/commands/listcommand.rb', line 9 def initialize(tracker) @tracker = tracker end |
Instance Method Details
#help(commandcontext) ⇒ Object
24 25 26 |
# File 'lib/commands/listcommand.rb', line 24 def help(commandcontext) commandcontext.output 'Use pug list [type [status]]' end |
#run(commandcontext) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/commands/listcommand.rb', line 13 def run(commandcontext) type = commandcontext.['type'] status = commandcontext.['status'] @tracker.all {|x| if (x.type.downcase == type || type == nil) && (x.status.downcase == status || status == nil) commandcontext.output(x) end } end |