Class: Optitron::Dsl::RootParserDsl

Inherits:
AbstractDsl show all
Defined in:
lib/optitron/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractDsl

#arg, #configure_with, #opt

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_optsObject (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