Class: OptParseBuilder::Argument
- Inherits:
-
Object
- Object
- OptParseBuilder::Argument
- Defined in:
- lib/opt_parse_builder/argument.rb
Overview
The base class for all arguments. You don’t create arguments explicitly; they are created by for you when you use the builder API.
Direct Known Subclasses
ArgumentBundle, BannerArgument, ConstantArgument, FooterArgument, NullArgument, OptionArgument, OptionalOperandArgument, RequiredOperandArgument, SeparatorArgument, SplatOperandArgument
Instance Method Summary collapse
-
#apply_option(_op) ⇒ Object
:nodoc:.
-
#banner_lines ⇒ Object
:nodoc:.
-
#footer_lines ⇒ Object
:nodoc:.
-
#key ⇒ Object
:nodoc:.
-
#operand_notation ⇒ Object
:nodoc:.
-
#optional ⇒ Object
Convert from a required operand to an optional one, returning a new argument.
-
#required ⇒ Object
Convert from a required operand to an optional one, returning a new argument.
-
#reset ⇒ Object
:nodoc:.
-
#separator_lines ⇒ Object
:nodoc:.
-
#shift_operand(_argv) ⇒ Object
:nodoc:.
-
#to_a ⇒ Object
:nodoc:.
-
#value ⇒ Object
Get an argument’s value.
-
#value=(_v) ⇒ Object
Set the argument’s value.
Instance Method Details
#apply_option(_op) ⇒ Object
:nodoc:
38 39 |
# File 'lib/opt_parse_builder/argument.rb', line 38 def apply_option(_op) # :nodoc: end |
#banner_lines ⇒ Object
:nodoc:
23 24 25 |
# File 'lib/opt_parse_builder/argument.rb', line 23 def # :nodoc: [] end |
#footer_lines ⇒ Object
:nodoc:
34 35 36 |
# File 'lib/opt_parse_builder/argument.rb', line 34 def # :nodoc: [] end |
#key ⇒ Object
:nodoc:
8 9 |
# File 'lib/opt_parse_builder/argument.rb', line 8 def key # :nodoc: end |
#operand_notation ⇒ Object
:nodoc:
27 28 |
# File 'lib/opt_parse_builder/argument.rb', line 27 def operand_notation # :nodoc: end |
#optional ⇒ Object
Convert from a required operand to an optional one, returning a new argument. Raises an error if that isn’t possible.
53 54 55 56 |
# File 'lib/opt_parse_builder/argument.rb', line 53 def optional raise BuildError, "cannot convert #{self.class.name} to an optional operand" end |
#required ⇒ Object
Convert from a required operand to an optional one, returning a new argument. Raises an error if that isn’t possible.
60 61 62 63 |
# File 'lib/opt_parse_builder/argument.rb', line 60 def required raise BuildError, "cannot convert #{self.class.name} to a required operand" end |
#reset ⇒ Object
:nodoc:
44 45 |
# File 'lib/opt_parse_builder/argument.rb', line 44 def reset # :nodoc: end |
#separator_lines ⇒ Object
:nodoc:
30 31 32 |
# File 'lib/opt_parse_builder/argument.rb', line 30 def separator_lines # :nodoc: [] end |
#shift_operand(_argv) ⇒ Object
:nodoc:
41 42 |
# File 'lib/opt_parse_builder/argument.rb', line 41 def shift_operand(_argv) # :nodoc: end |
#to_a ⇒ Object
:nodoc:
47 48 49 |
# File 'lib/opt_parse_builder/argument.rb', line 47 def to_a # :nodoc: [self] end |
#value ⇒ Object
Get an argument’s value. Returns nil if the argument has no value. This is made public for the use of a handler proc (See ArgumentBuilder#handler).
14 15 |
# File 'lib/opt_parse_builder/argument.rb', line 14 def value end |
#value=(_v) ⇒ Object
Set the argument’s value. Does nothing if the argument has no value. This is made public for the use of a handler proc (See ArgumentBuilder#handler).
20 21 |
# File 'lib/opt_parse_builder/argument.rb', line 20 def value=(_v) end |