Module: Vedeu::Attributes
- Extended by:
- Attributes
- Included in:
- Attributes
- Defined in:
- lib/vedeu/models/attributes/attributes.rb
Instance Method Summary collapse
Instance Method Details
#coerce_styles(values) ⇒ Object
19 20 21 22 23 |
# File 'lib/vedeu/models/attributes/attributes.rb', line 19 def coerce_styles(values) return '' if values.nil? || values.empty? Array(values).flatten.map { |s| Esc.string(s) }.join end |
#coercer(value, model, key) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vedeu/models/attributes/attributes.rb', line 5 def coercer(value, model, key) return [] if value.nil? || value.empty? [value].flatten.map do |v| if v.is_a?(model) v else model.new(v) end end end |