Class: PBM::Commands::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/pbm/commands/help.rb

Instance Method Summary collapse

Constructor Details

#initialize(interpreter) ⇒ Help

Returns a new instance of Help.



4
5
6
# File 'lib/pbm/commands/help.rb', line 4

def initialize(interpreter)
  @interpreter = interpreter
end

Instance Method Details

#descriptionObject



8
9
10
# File 'lib/pbm/commands/help.rb', line 8

def description
  'help - displays this help'
end

#runObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/pbm/commands/help.rb', line 12

def run
  <<-HELP.gsub(/^ {10}/, '')

    List of commands:
    -----------------

    #{@interpreter.commands.values.map(&:description).sort.join("\n")}

  HELP
end