Class: Polytrix::Validations
- Inherits:
-
Set
- Object
- Set
- Polytrix::Validations
- Defined in:
- lib/polytrix/validations.rb
Class Method Summary collapse
-
.coerce(obj) ⇒ Object
Hashie Coercion - automatically treat all values as Validation.
Instance Method Summary collapse
Class Method Details
.coerce(obj) ⇒ Object
Hashie Coercion - automatically treat all values as Validation
16 17 18 19 20 21 |
# File 'lib/polytrix/validations.rb', line 16 def self.coerce(obj) data = obj.map do |value| Validation.new(value) end new data end |
Instance Method Details
#to_hash ⇒ Object
5 6 7 8 9 |
# File 'lib/polytrix/validations.rb', line 5 def to_hash map do |v| v.to_hash end end |
#to_yaml ⇒ Object
11 12 13 |
# File 'lib/polytrix/validations.rb', line 11 def to_yaml to_hash.to_yaml end |