class ComposedValidations::WithValidatedProperty
Attributes
property[R]
validator[R]
Public Class Methods
new(resource, property, validator)
click to toggle source
Calls superclass method
# File lib/composed_validations/with_validated_property.rb, line 4 def initialize(resource, property, validator) super(resource) @property = ComposedValidations::ValidatedProperty(property) @validator = validator end
Public Instance Methods
class()
click to toggle source
# File lib/composed_validations/with_validated_property.rb, line 10 def class __getobj__.class end
save(*args)
click to toggle source
# File lib/composed_validations/with_validated_property.rb, line 22 def save(*args) return false unless valid? __getobj__.save(*args) end
valid?(*args)
click to toggle source
# File lib/composed_validations/with_validated_property.rb, line 14 def valid?(*args) __getobj__.valid?(*args) unless validator.valid_value?(result) errors.add(property.validated_property, validator.message) end errors.blank? end
Private Instance Methods
result()
click to toggle source
# File lib/composed_validations/with_validated_property.rb, line 29 def result __send__(property.property_accessor) end