Class: Ame::Option
Overview
Represents an option to a Method that takes an argument. If an explicit (‘=’-separated) argument is given, it’ll be used, otherwise the following argument will be used.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Switch
Attributes inherited from Flag
#default, #description, #long, #short
Instance Method Summary collapse
-
#initialize(short, long, argument, default, description) {|?| ... } ⇒ Option
constructor
A new instance of Option.
-
#process_combined(options, arguments, name, remainder) ⇒ [Boolean, '']
Invokes Flag#process with REMAINDER as the explicit argument if it’s non-empty.
Methods inherited from Flag
#ignored?, #name, #names, #process
Constructor Details
#initialize(short, long, argument, default, description) {|?| ... } ⇒ Option
Returns a new instance of Option.
15 16 17 |
# File 'lib/ame-1.0/option.rb', line 15 def initialize(short, long, argument, default, description, &validate) super short, long, argument, default, nil, description, &validate end |
Instance Method Details
#process_combined(options, arguments, name, remainder) ⇒ [Boolean, '']
Invokes Flag#process with REMAINDER as the explicit argument if it’s non-empty.
24 25 26 |
# File 'lib/ame-1.0/option.rb', line 24 def process_combined(, arguments, name, remainder) [process(, arguments, name, remainder.empty? ? nil : remainder), ''] end |