Class: Optitron::Dsl::RootParserDsl
- Inherits:
-
AbstractDsl
- Object
- AbstractDsl
- Optitron::Dsl::RootParserDsl
- Defined in:
- lib/optitron/dsl.rb
Instance Attribute Summary collapse
-
#short_opts ⇒ Object
readonly
Returns the value of attribute short_opts.
Instance Method Summary collapse
- #cmd(name, description = nil, opts = nil, &blk) ⇒ Object
-
#initialize(parser) ⇒ RootParserDsl
constructor
A new instance of RootParserDsl.
Methods inherited from AbstractDsl
Constructor Details
#initialize(parser) ⇒ RootParserDsl
Returns a new instance of RootParserDsl.
47 48 49 50 |
# File 'lib/optitron/dsl.rb', line 47 def initialize(parser) @short_opts = [] @target = parser end |
Instance Attribute Details
#short_opts ⇒ Object (readonly)
Returns the value of attribute short_opts.
46 47 48 |
# File 'lib/optitron/dsl.rb', line 46 def short_opts @short_opts end |
Instance Method Details
#cmd(name, description = nil, opts = nil, &blk) ⇒ Object
52 53 54 55 56 |
# File 'lib/optitron/dsl.rb', line 52 def cmd(name, description = nil, opts = nil, &blk) command_option = Option::Cmd.new(name, description, opts) CmdParserDsl.new(self, command_option).configure_with(blk) if blk @target.commands[name] = command_option end |