Class: Lab42::Options::Parser
- Inherits:
-
Object
- Object
- Lab42::Options::Parser
- Defined in:
- lib/lab42/options/parser.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#defaults ⇒ Object
Returns the value of attribute defaults.
-
#kwds ⇒ Object
Returns the value of attribute kwds.
-
#positionals ⇒ Object
Returns the value of attribute positionals.
-
#yaml_file ⇒ Object
Returns the value of attribute yaml_file.
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/lab42/options/parser.rb', line 5 def data @data end |
#defaults ⇒ Object
Returns the value of attribute defaults.
5 6 7 |
# File 'lib/lab42/options/parser.rb', line 5 def defaults @defaults end |
#kwds ⇒ Object
Returns the value of attribute kwds.
5 6 7 |
# File 'lib/lab42/options/parser.rb', line 5 def kwds @kwds end |
#positionals ⇒ Object
Returns the value of attribute positionals.
5 6 7 |
# File 'lib/lab42/options/parser.rb', line 5 def positionals @positionals end |
#yaml_file ⇒ Object
Returns the value of attribute yaml_file.
5 6 7 |
# File 'lib/lab42/options/parser.rb', line 5 def yaml_file @yaml_file end |
Instance Method Details
#parse(options, args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/lab42/options/parser.rb', line 6 def parse , args self.yaml_file = .yaml_file self.data = {to_a: args} self.kwds = {} self.positionals = [] parse_all args # read_yaml file might need the args parsed defaults = read_yaml_file data.merge kwds: OpenStruct.new(defaults.merge(kwds)), args: positionals end |