Method: CommandMapper::OptionValue#validate

Defined in:
lib/command_mapper/option_value.rb

#validate(value) ⇒ true, (false, String)

Validates whether a given value is compatible with the option Arg#type.

Parameters:

  • value (Object)

    The given value to validate.

Returns:

  • (true, (false, String))

    Returns true if the value is valid, or false and a validation error message if the value is not compatible.



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