Class: CLAide::Argument
- Inherits:
-
Object
- Object
- CLAide::Argument
- Defined in:
- lib/claide/argument.rb
Overview
This class is used to represent individual arguments to present to the command help banner
Constant Summary collapse
- ELLIPSIS =
The string used for ellipsis / repeatable arguments in the banner
'...'
Instance Attribute Summary collapse
-
#names ⇒ Array<String>
readonly
List of alternate names for the parameters.
-
#repeatable ⇒ Boolean
(also: #repeatable?)
Indicates if the argument is repeatable (= can appear multiple times in the command, which is indicated by '...' in the banner).
-
#required ⇒ Boolean
(also: #required?)
Indicates if the argument is required (not optional).
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
True on equality.
-
#initialize(names, required, repeatable = false) ⇒ Argument
constructor
A new instance of Argument.
Constructor Details
#initialize(names, required, repeatable = false) ⇒ Argument
Returns a new instance of Argument.
47 48 49 50 51 |
# File 'lib/claide/argument.rb', line 47 def initialize(names, required, repeatable = false) @names = Array(names) @required = required @repeatable = repeatable end |
Instance Attribute Details
#names ⇒ Array<String> (readonly)
Returns List of alternate names for the parameters.
14 15 16 |
# File 'lib/claide/argument.rb', line 14 def names @names end |
#repeatable ⇒ Boolean Also known as: repeatable?
Returns Indicates if the argument is repeatable (= can appear multiple times in the command, which is indicated by '...' in the banner).
26 27 28 |
# File 'lib/claide/argument.rb', line 26 def repeatable @repeatable end |
#required ⇒ Boolean Also known as: required?
Returns Indicates if the argument is required (not optional).
19 20 21 |
# File 'lib/claide/argument.rb', line 19 def required @required end |
Instance Method Details
#==(other) ⇒ Boolean
Returns true on equality.
57 58 59 60 |
# File 'lib/claide/argument.rb', line 57 def ==(other) other.is_a?(Argument) && names == other.names && required == other.required end |