Class: Cliqr::ArgumentValidation::ArgumentTypeValidator Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cliqr/argument_validation/argument_type_validator.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.

Validates type of a argument

Instance Method Summary collapse

Instance Method Details

#validate(argument, option, errors) ⇒ Cliqr:ValidationErrors

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.

Run the validation on a argument based on the option’s configuration

Returns:

  • (Cliqr:ValidationErrors)


9
10
11
12
13
# File 'lib/cliqr/argument_validation/argument_type_validator.rb', line 9

def validate(argument, option, errors)
  errors.add("only values of type '#{option.type}' allowed for option '#{option.name}'") \
    unless type_of?(argument, option.type)
  errors
end