Class: Alx::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/alx/handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(details) ⇒ Handler

Returns a new instance of Handler.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/alx/handler.rb', line 10

def initialize( details )
  @conf = details[ :configuration ]
  @command_name = details[ :command ]

  @opts = OptionParser.new
  banner_text = @command_name
  banner_text += ' [options]' if details[ :options ]
  banner_text += " <#{details[ :rest_description ]}>" if details[ :rest_description ]
  banner_text += "\n  #{details[ :description ]}"
  add_options( details[ :options ] ) if details[ :options ]
  @opts.banner = banner_text
end

Instance Attribute Details

#command_nameObject (readonly)

Returns the value of attribute command_name.



8
9
10
# File 'lib/alx/handler.rb', line 8

def command_name
  @command_name
end

Instance Method Details

#helpObject



23
24
25
# File 'lib/alx/handler.rb', line 23

def help
  @opts.help
end