Class: DataMapper::Types::CommaSeparatedList
- Defined in:
- lib/dm-types/comma_separated_list.rb
Class Method Summary collapse
Methods inherited from Yaml
Class Method Details
.dump(value, property) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dm-types/comma_separated_list.rb', line 12 def self.dump(value, property) if value.nil? nil elsif value.kind_of?(Array) super(value, property) elsif value.kind_of?(String) v = (value || "").split(","). compact. map { |i| i.downcase.strip }. reject { |i| i.blank? }. uniq super(v, property) else raise ArgumentError, "+value+ of CommaSeparatedList must be a string, an array or nil, but given #{value.inspect}" end end |