Class: Veto::AttributeValidatorFactory
- Inherits:
-
Object
- Object
- Veto::AttributeValidatorFactory
- Defined in:
- lib/veto/attribute_validator_factory.rb
Class Method Summary collapse
Class Method Details
.new_validator(type, attribute, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/veto/attribute_validator_factory.rb', line 18 def self.new_validator type, attribute, ={} klass_name = "#{camel_case(type.to_s)}Validator" begin klass = Veto.const_get(klass_name) rescue NameError => e raise(ArgumentError, "Validator not found: ::Veto::#{klass_name}") end klass.new(attribute, ) end |