Class: OptParseBuilder::ArgumentBundle
- Defined in:
- lib/opt_parse_builder/argument_bundle.rb
Overview
:nodoc:
Instance Method Summary collapse
- #<<(argument) ⇒ Object
-
#initialize ⇒ ArgumentBundle
constructor
A new instance of ArgumentBundle.
- #simplify ⇒ Object
- #to_a ⇒ Object
Methods inherited from Argument
#apply_option, #banner_lines, #footer_lines, #key, #operand_notation, #optional, #required, #reset, #separator_lines, #shift_operand, #value, #value=
Constructor Details
#initialize ⇒ ArgumentBundle
Returns a new instance of ArgumentBundle.
4 5 6 |
# File 'lib/opt_parse_builder/argument_bundle.rb', line 4 def initialize @arguments = [] end |
Instance Method Details
#<<(argument) ⇒ Object
8 9 10 |
# File 'lib/opt_parse_builder/argument_bundle.rb', line 8 def <<(argument) @arguments << argument end |
#simplify ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/opt_parse_builder/argument_bundle.rb', line 18 def simplify case @arguments.count when 0 NullArgument.new when 1 @arguments.first else self end end |
#to_a ⇒ Object
12 13 14 15 16 |
# File 'lib/opt_parse_builder/argument_bundle.rb', line 12 def to_a @arguments.reduce([]) do |a, arg| a + arg.to_a end end |