Class: DataMapper::Property::PgArray

Inherits:
Object
  • Object
show all
Defined in:
lib/dm-postgres-types/property/pg_array.rb

Direct Known Subclasses

PgNumericArray

Instance Method Summary collapse

Instance Method Details

#dump(value) ⇒ Object



14
15
16
17
# File 'lib/dm-postgres-types/property/pg_array.rb', line 14

def dump(value)
  return nil if value.nil?
  "{#{CSV.generate_line(value, row_sep: '')}}"
end

#load(value) ⇒ Object



8
9
10
11
12
# File 'lib/dm-postgres-types/property/pg_array.rb', line 8

def load(value)
  return [] if value.nil?
  value.gsub!(/[{}]/,'')
  CSV.parse_line(value) || []
end