Class: CommandKit::Arguments::Argument Private
- Inherits:
-
ArgumentValue
- Object
- ArgumentValue
- CommandKit::Arguments::Argument
- Defined in:
- lib/command_kit/arguments/argument.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents a defined argument.
Instance Attribute Summary collapse
-
#desc ⇒ String
readonly
private
The argument's description.
-
#name ⇒ Symbol
readonly
private
The argument's name.
Attributes inherited from ArgumentValue
Instance Method Summary collapse
-
#initialize(name, usage: name.to_s.upcase, required: true, repeats: false, desc:) {|(value)| ... } ⇒ Argument
constructor
private
Initializes the argument.
-
#repeats? ⇒ Boolean
private
Specifies whether the argument can be repeated repeat times.
-
#usage ⇒ String
private
The usage string for the argument.
Methods inherited from ArgumentValue
Constructor Details
#initialize(name, usage: name.to_s.upcase, required: true, repeats: false, desc:) {|(value)| ... } ⇒ Argument
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the argument.
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/command_kit/arguments/argument.rb', line 46 def initialize(name, usage: name.to_s.upcase, required: true, repeats: false, desc: ) super( usage: usage, required: required ) @name = name @repeats = repeats @desc = desc end |
Instance Attribute Details
#desc ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The argument's description.
20 21 22 |
# File 'lib/command_kit/arguments/argument.rb', line 20 def desc @desc end |
#name ⇒ Symbol (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The argument's name.
15 16 17 |
# File 'lib/command_kit/arguments/argument.rb', line 15 def name @name end |
Instance Method Details
#repeats? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Specifies whether the argument can be repeated repeat times.
65 66 67 |
# File 'lib/command_kit/arguments/argument.rb', line 65 def repeats? @repeats end |
#usage ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The usage string for the argument.
74 75 76 77 78 79 |
# File 'lib/command_kit/arguments/argument.rb', line 74 def usage string = @usage string = "#{string} ..." if repeats? string = "[#{string}]" if optional? string end |