Class: R2do::Commands::NowCommand
- Inherits:
-
R2do::Command
- Object
- R2do::Command
- R2do::Commands::NowCommand
- Defined in:
- lib/r2do/commands/now_command.rb
Instance Attribute Summary
Attributes inherited from R2do::Command
#description, #extended, #short
Instance Method Summary collapse
-
#display_current_category(args) ⇒ void
Shows the detailed information for the current category, including the tasks contained.
-
#execute(args) ⇒ void
Creates a new category or makes a category current in the state if a category with the same name already exists.
- #help ⇒ Object
-
#initialize(state) ⇒ NowCommand
constructor
A new instance of NowCommand.
Methods inherited from R2do::Command
Constructor Details
#initialize(state) ⇒ NowCommand
Returns a new instance of NowCommand.
21 22 23 24 25 |
# File 'lib/r2do/commands/now_command.rb', line 21 def initialize(state) super('n', 'now', 'Displays the information for the current category.') @state = state end |
Instance Method Details
#display_current_category(args) ⇒ void
This method returns an undefined value.
Shows the detailed information for the current category, including the tasks contained
41 42 43 44 45 46 47 48 49 |
# File 'lib/r2do/commands/now_command.rb', line 41 def display_current_category(args) #TODO: need to refatctor the code to remove the duplication if not @state.current_category UI.status("No category is currently selected.") else UI.status(@state.current_category.to_s) UI.new_line() end end |
#execute(args) ⇒ void
This method returns an undefined value.
Creates a new category or makes a category current in the state if a category with the same name already exists
33 34 35 |
# File 'lib/r2do/commands/now_command.rb', line 33 def execute(args) display_current_category(args) end |
#help ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/r2do/commands/now_command.rb', line 51 def help() help = <<-EOF NAME r2do #{@extended} SYNOPSIS 'r2do #{@extended}' or 'r2do #{@short}' are equivalent DESCRIPTION The #{@extended} lets view the current category and its tasks usage: r2do #{@extended} EOF end |