Class: Lita::Extensions::KeywordArguments::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/extensions/keyword_arguments/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject (readonly)

Returns the value of attribute args.



7
8
9
# File 'lib/lita/extensions/keyword_arguments/parser.rb', line 7

def args
  @args
end

#specObject (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

#parseObject



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