Methods

DataMapper::Property::CommaSeparatedList

Public Instance Methods

dump(value) click to toggle source
# File lib/dm-types/comma_separated_list.rb, line 8
def dump(value)
  if value.nil?
    nil
  elsif value.kind_of?(::Array)
    super(value)
  elsif value.kind_of?(::String)
    v = []

    value.split(',').each do |element|
      element.strip!
      v << element unless element.empty?
    end

    super(v)
  else
    raise ArgumentError, "+value+ of CommaSeparatedList must be a string, an array or nil, but given #{value.inspect}"
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.