Class: DataMapper::Types::Csv
- Inherits:
-
DataMapper::Type
- Object
- DataMapper::Type
- DataMapper::Types::Csv
- Defined in:
- lib/gems/dm-types-0.9.9/lib/dm-types/csv.rb
Constant Summary
Constants inherited from DataMapper::Type
DataMapper::Type::PROPERTY_OPTIONS, DataMapper::Type::PROPERTY_OPTION_ALIASES
Class Method Summary collapse
Methods inherited from DataMapper::Type
bind, configure, inherited, options, primitive
Class Method Details
.dump(value, property) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gems/dm-types-0.9.9/lib/dm-types/csv.rb', line 16 def self.dump(value, property) case value when Array then FasterCSV.generate do |csv| value.each { |row| csv << row } end when String then value else nil end end |
.load(value, property) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/gems/dm-types-0.9.9/lib/dm-types/csv.rb', line 8 def self.load(value, property) case value when String then FasterCSV.parse(value) when Array then value else nil end end |