Class: Sekisyo::Validator
- Inherits:
-
Object
- Object
- Sekisyo::Validator
- Extended by:
- Forwardable
- Defined in:
- lib/sekisyo/validator.rb
Overview
Sekisyo Validator is manages each validator in one place.
Constant Summary collapse
- VALIDATORS =
{ 'any' => Sekisyo::Validators::AnyValidator, 'array' => Sekisyo::Validators::ArrayValidator, 'boolean' => Sekisyo::Validators::BooleanValidator, 'file' => Sekisyo::Validators::FileValidator, 'float' => Sekisyo::Validators::FloatValidator, 'integer' => Sekisyo::Validators::IntegerValidator, 'numeric' => Sekisyo::Validators::NumericValidator, 'object' => Sekisyo::Validators::ObjectValidator, 'string' => Sekisyo::Validators::StringValidator }.freeze
Instance Method Summary collapse
-
#initialize(key, options = {}) ⇒ Validator
constructor
A new instance of Validator.
Constructor Details
#initialize(key, options = {}) ⇒ Validator
Returns a new instance of Validator.
33 34 35 36 37 |
# File 'lib/sekisyo/validator.rb', line 33 def initialize(key, = {}) validator_class = VALIDATORS[.delete('type')] validator_class ||= Sekisyo::Validators::AnyValidator @validator = validator_class.new(key, ) end |