Class: DataMapper::Types::Csv
- Inherits:
-
DataMapper::Type
- Object
- DataMapper::Type
- DataMapper::Types::Csv
- Defined in:
- lib/dm-types/csv.rb
Class Method Summary collapse
Class Method Details
.dump(value, property) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/dm-types/csv.rb', line 23 def self.dump(value, property) case value when Array then CSV.generate { |csv| value.each { |row| csv << row } } when String then value else nil end end |
.load(value, property) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/dm-types/csv.rb', line 14 def self.load(value, property) case value when String then CSV.parse(value) when Array then value else nil end end |