Class: Alx::HelpHandler

Inherits:
Handler show all
Defined in:
lib/alx/help_handler.rb

Instance Attribute Summary

Attributes inherited from Handler

#command_name

Instance Method Summary collapse

Methods inherited from Handler

#help

Constructor Details

#initialize(configuration, controller) ⇒ HelpHandler

Returns a new instance of HelpHandler.



6
7
8
9
10
11
12
13
# File 'lib/alx/help_handler.rb', line 6

def initialize( configuration, controller )
  super(
    :configuration => configuration,
    :command => 'help',
    :rest_description => 'command',
    :description => "Gives more information on defined command." )
  @controller = controller
end

Instance Method Details

#handleObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/alx/help_handler.rb', line 15

def handle
  parse_options
  handler = @controller.handlers[ @conf[ :rest ] ]
  if handler
    puts handler.help
    return;
  end

  default_help
end