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.
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/command_kit/arguments/argument.rb', line 48 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.
22 23 24 |
# File 'lib/command_kit/arguments/argument.rb', line 22 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.
17 18 19 |
# File 'lib/command_kit/arguments/argument.rb', line 17 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.
67 68 69 |
# File 'lib/command_kit/arguments/argument.rb', line 67 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.
76 77 78 79 80 81 |
# File 'lib/command_kit/arguments/argument.rb', line 76 def usage string = @usage string = "#{string} ..." if repeats? string = "[#{string}]" if optional? string end |