Module: Cliqr::Config::Validation::ValidatorFactory Private
- Defined in:
- lib/cliqr/config/validation/validator_factory.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
A factory class to retrieve a attribute validator based on the configuration type
Defined Under Namespace
Classes: ChildValidator, CollectionValidator, FormatValidator, HashValidator, InclusionValidator, NOOPValidator, NonEmptyFormatValidator, NonEmptyNilOkFormatValidator, NonEmptyValidator, NonNilValidator, OneOfValidator, TypeHierarchyValidator, TypeOfValidator, Validator
Constant Summary collapse
- VALIDATORS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
A hash of validator type id to validator class
{ :non_empty => NonEmptyValidator, :non_empty_format => NonEmptyFormatValidator, :non_empty_nil_ok_format => NonEmptyNilOkFormatValidator, :format => FormatValidator, :extend => TypeHierarchyValidator, :collection => CollectionValidator, :hash => HashValidator, :inclusion => InclusionValidator, :one_of => OneOfValidator, :type_of => TypeOfValidator, :child => ChildValidator }
Class Method Summary collapse
-
.get(validator_type, config) ⇒ Cliqr::Validation::ValidatorFactory::Validator
private
Get a new validator based on the type and config param.
Class Method Details
.get(validator_type, config) ⇒ Cliqr::Validation::ValidatorFactory::Validator
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 a new validator based on the type and config param
392 393 394 395 396 397 398 399 |
# File 'lib/cliqr/config/validation/validator_factory.rb', line 392 def self.get(validator_type, config) validator_class = VALIDATORS[validator_type] if validator_class.nil? NOOPValidator.new(validator_type) else validator_class.new(config) end end |