Class: OptparseLite::OptParserAggregate
- Inherits:
-
Object
- Object
- OptparseLite::OptParserAggregate
- Defined in:
- lib/optparse-lite.rb
Overview
we take this opportunity to discover our interface for parsers: parse()
Instance Method Summary collapse
-
#initialize(parsers) ⇒ OptParserAggregate
constructor
A new instance of OptParserAggregate.
- #parse(args) ⇒ Object
Constructor Details
#initialize(parsers) ⇒ OptParserAggregate
Returns a new instance of OptParserAggregate.
853 854 855 |
# File 'lib/optparse-lite.rb', line 853 def initialize parsers @parsers = parsers end |
Instance Method Details
#parse(args) ⇒ Object
856 857 858 859 860 861 862 863 864 |
# File 'lib/optparse-lite.rb', line 856 def parse args errors, opts = @parsers.first.parse(args) @parsers[1..-1].each do |parser| unparsed = errors.delete(:unparsed_parameters) || {} errors.concat parser.validate_and_populate(unparsed) opts.merge! unparsed end [errors, opts] end |