Class: Pug::HelpAction
- Inherits:
-
Interfaces::Action
- Object
- Interfaces::Action
- Pug::HelpAction
- Defined in:
- lib/pug/help_action.rb
Overview
Lists all the system defined actions
Instance Method Summary collapse
-
#execute ⇒ String
Override of Interfaces::Action#execute.
-
#initialize(actions) ⇒ HelpAction
constructor
A new instance of HelpAction.
-
#name ⇒ String
Override of Interfaces::Action#name.
Methods inherited from Interfaces::Action
#description, #requires_input?
Constructor Details
#initialize(actions) ⇒ HelpAction
Returns a new instance of HelpAction.
8 9 10 |
# File 'lib/pug/help_action.rb', line 8 def initialize(actions) @actions = actions end |
Instance Method Details
#execute ⇒ String
Override of Interfaces::Action#execute
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pug/help_action.rb', line 22 def execute return Strings.no_help_commands if @actions.empty? actions = @actions.map do |action| if action.description.to_s.empty? action.name else "#{action.name} # #{action.description}" end end Strings.help(actions.join("\n")) end |
#name ⇒ String
Override of Interfaces::Action#name
16 17 18 |
# File 'lib/pug/help_action.rb', line 16 def name '' end |