Class: ComposedValidations::PropertyValidator
- Inherits:
-
Object
- Object
- ComposedValidations::PropertyValidator
- Defined in:
- lib/composed_validations/property_validator.rb
Instance Attribute Summary collapse
-
#property ⇒ Object
readonly
Returns the value of attribute property.
-
#validators ⇒ Object
readonly
Returns the value of attribute validators.
Instance Method Summary collapse
- #decorate_resource(resource) ⇒ Object
-
#initialize(property, validators) ⇒ PropertyValidator
constructor
A new instance of PropertyValidator.
Constructor Details
#initialize(property, validators) ⇒ PropertyValidator
Returns a new instance of PropertyValidator.
4 5 6 7 |
# File 'lib/composed_validations/property_validator.rb', line 4 def initialize(property, validators) @property = property @validators = Array(validators) end |
Instance Attribute Details
#property ⇒ Object (readonly)
Returns the value of attribute property.
3 4 5 |
# File 'lib/composed_validations/property_validator.rb', line 3 def property @property end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
3 4 5 |
# File 'lib/composed_validations/property_validator.rb', line 3 def validators @validators end |
Instance Method Details
#decorate_resource(resource) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/composed_validations/property_validator.rb', line 9 def decorate_resource(resource) validators.each do |validator| resource = WithValidatedProperty.new(resource, property, validator) end resource end |