Class: DataMapper::Types::Csv

Public Visibility

Public Class Method Summary

dump(value, property)
load(value, property)

Public Class Methods Inherited from DataMapper::Type

bind, configure, inherited, options, primitive

Public Instance Methods Inherited from Object

validatable?

Public Class Method Details

dump

public dump(value, property)
[View source]


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'dm-more/dm-types/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

public load(value, property)
[View source]


8
9
10
11
12
13
14
15
16
17
18
# File 'dm-more/dm-types/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