Class: Alx::Handler
- Inherits:
-
Object
- Object
- Alx::Handler
- Defined in:
- lib/alx/handler.rb
Direct Known Subclasses
AddHandler, HelpHandler, ListHandler, RemoveHandler, ShowHandler
Instance Attribute Summary collapse
-
#command_name ⇒ Object
readonly
Returns the value of attribute command_name.
Instance Method Summary collapse
- #help ⇒ Object
-
#initialize(details) ⇒ Handler
constructor
A new instance of Handler.
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 = @command_name += ' [options]' if details[ :options ] += " <#{details[ :rest_description ]}>" if details[ :rest_description ] += "\n #{details[ :description ]}" ( details[ :options ] ) if details[ :options ] @opts. = end |
Instance Attribute Details
#command_name ⇒ Object (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
#help ⇒ Object
23 24 25 |
# File 'lib/alx/handler.rb', line 23 def help @opts.help end |