Class: Cliqr::ArgumentValidation::OptionValidator Private
- Inherits:
-
Object
- Object
- Cliqr::ArgumentValidation::OptionValidator
- Defined in:
- lib/cliqr/argument_validation/option_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.
Runs all validators configured for an option
Instance Method Summary collapse
-
#add(validator) ⇒ Set
private
Add a validator for this option.
-
#initialize ⇒ OptionValidator
constructor
private
Create a new option validator.
-
#validate(argument, option, errors) ⇒ Cliqr::ValidationErrors
private
Run all the validators for a option.
Constructor Details
#initialize ⇒ OptionValidator
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 option validator
7 8 9 |
# File 'lib/cliqr/argument_validation/option_validator.rb', line 7 def initialize @validators = Set.new [] end |
Instance Method Details
#add(validator) ⇒ Set
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.
Add a validator for this option
14 15 16 |
# File 'lib/cliqr/argument_validation/option_validator.rb', line 14 def add(validator) @validators.add(validator) end |
#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 all the validators for a option
21 22 23 24 |
# File 'lib/cliqr/argument_validation/option_validator.rb', line 21 def validate(argument, option, errors) @validators.each { |validator| validator.validate(argument, option, errors) } errors end |