Class: DataMapper::Validations::PrimitiveTypeValidator
- Inherits:
-
GenericValidator
- Object
- GenericValidator
- DataMapper::Validations::PrimitiveTypeValidator
- Defined in:
- lib/dm-validations/validators/primitive_validator.rb
Overview
Instance Attribute Summary
Attributes inherited from GenericValidator
#field_name, #humanized_field_name, #if_clause, #options, #unless_clause
Instance Method Summary collapse
Methods inherited from GenericValidator
#==, #add_error, #evaluate_conditional_clause, #execute?, #initialize, #inspect, #optional?, #set_optional_by_default
Constructor Details
This class inherits a constructor from DataMapper::Validations::GenericValidator
Instance Method Details
#call(target) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dm-validations/validators/primitive_validator.rb', line 7 def call(target) value = target.validation_property_value(field_name) property = get_resource_property(target, field_name) return true if value.nil? || property.primitive?(value) = @options[:message] || default_error(property) add_error(target, , field_name) false end |