Class: Optitron::Dsl
- Inherits:
-
Object
- Object
- Optitron::Dsl
- Defined in:
- lib/optitron/dsl.rb
Defined Under Namespace
Classes: AbstractDsl, CmdParserDsl, RootParserDsl
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #configure_options ⇒ Object
-
#initialize(parser, &blk) ⇒ Dsl
constructor
A new instance of Dsl.
Constructor Details
#initialize(parser, &blk) ⇒ Dsl
Returns a new instance of Dsl.
5 6 7 8 9 10 11 |
# File 'lib/optitron/dsl.rb', line 5 def initialize(parser, &blk) @root = RootParserDsl.new(parser) if blk @root.configure_with(&blk) end end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
3 4 5 |
# File 'lib/optitron/dsl.rb', line 3 def root @root end |
Instance Method Details
#configure_options ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/optitron/dsl.rb', line 13 def @root.unclaimed_opts.each do |opt_option| name = opt_option.name if !@root.short_opts.key?(name[0].chr) opt_option.short_name = name[0].chr @root.short_opts[name[0].chr] = opt_option elsif !@root.short_opts.key?(name.upcase[0].chr) opt_option.short_name = name.upcase[0].chr @root.short_opts[name.upcase[0].chr] = opt_option end end end |