Class: Lita::Extensions::KeywordArguments::Parser
- Inherits:
-
Object
- Object
- Lita::Extensions::KeywordArguments::Parser
- Defined in:
- lib/lita/extensions/keyword_arguments/parser.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Instance Method Summary collapse
-
#initialize(spec, args) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(spec, args) ⇒ Parser
Returns a new instance of Parser.
9 10 11 12 |
# File 'lib/lita/extensions/keyword_arguments/parser.rb', line 9 def initialize(spec, args) @spec = spec @args = prepare_args(args) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
7 8 9 |
# File 'lib/lita/extensions/keyword_arguments/parser.rb', line 7 def args @args end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
7 8 9 |
# File 'lib/lita/extensions/keyword_arguments/parser.rb', line 7 def spec @spec end |
Instance Method Details
#parse ⇒ Object
14 15 16 17 18 |
# File 'lib/lita/extensions/keyword_arguments/parser.rb', line 14 def parse spec.each { |name, option_spec| add_option(name, option_spec) } parser.parse(args) parser.to_hash end |