Class: CommandMapper::OptionValue
- Defined in:
- lib/command_mapper/option_value.rb
Overview
Represents the value for an option.
Instance Attribute Summary
Attributes inherited from Arg
Instance Method Summary collapse
-
#format(value) ⇒ String
Formats a value using the options Arg#type.
-
#validate(value) ⇒ true, (false, String)
Validates whether a given value is compatible with the option Arg#type.
Methods inherited from Arg
#initialize, #optional?, #required?
Constructor Details
This class inherits a constructor from CommandMapper::Arg
Instance Method Details
#format(value) ⇒ String
Formats a value using the options Arg#type.
40 41 42 |
# File 'lib/command_mapper/option_value.rb', line 40 def format(value) @type.format(value) end |
#validate(value) ⇒ true, (false, String)
Validates whether a given value is compatible with the option Arg#type.
21 22 23 24 25 26 27 |
# File 'lib/command_mapper/option_value.rb', line 21 def validate(value) if !required? && value == true return true else super(value) end end |