Class: Cliqr::Command::CommandOption Private
- Inherits:
-
Object
- Object
- Cliqr::Command::CommandOption
- Defined in:
- lib/cliqr/command/command_context.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.
A holder class for a command line argument’s name and value
Instance Attribute Summary collapse
-
#name ⇒ String
private
Name of a command line argument option.
-
#values ⇒ Array
private
Value array for the command line argument’s option.
Instance Method Summary collapse
-
#initialize(name, values, option_config) ⇒ Cliqr::Command::CommandContext
constructor
private
Create a new command line option instance.
-
#to_s ⇒ String
private
Get string representation for this option.
-
#value ⇒ Object
private
Get value for this option.
Constructor Details
#initialize(name, values, option_config) ⇒ Cliqr::Command::CommandContext
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.
Create a new command line option instance
263 264 265 266 |
# File 'lib/cliqr/command/command_context.rb', line 263 def initialize(name, values, option_config) @name = name @values = values.map { |value| run_value_operator(value, option_config.operator) } end |
Instance Attribute Details
#name ⇒ 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.
Name of a command line argument option
249 250 251 |
# File 'lib/cliqr/command/command_context.rb', line 249 def name @name end |
#values ⇒ Array
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.
Value array for the command line argument’s option
254 255 256 |
# File 'lib/cliqr/command/command_context.rb', line 254 def values @values end |
Instance Method Details
#to_s ⇒ 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.
Get string representation for this option
279 280 281 |
# File 'lib/cliqr/command/command_context.rb', line 279 def to_s value.to_s end |
#value ⇒ Object
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.
Get value for this option
271 272 273 274 |
# File 'lib/cliqr/command/command_context.rb', line 271 def value return values.first if values.length == 1 values.join(',') end |