Class: Pug::HelpAction

Inherits:
Interfaces::Action show all
Defined in:
lib/pug/help_action.rb

Overview

Lists all the system defined actions

Instance Method Summary collapse

Methods inherited from Interfaces::Action

#description, #requires_input?

Constructor Details

#initialize(actions) ⇒ HelpAction

Returns a new instance of HelpAction.

Parameters:



8
9
10
# File 'lib/pug/help_action.rb', line 8

def initialize(actions)
  @actions = actions
end

Instance Method Details

#executeString

Returns:



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

#nameString

Returns:



16
17
18
# File 'lib/pug/help_action.rb', line 16

def name
  ''
end