Module: MongoMapper::Extensions::Array

Included in:
Array
Defined in:
lib/mongo_mapper/extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#from_mongo(value) ⇒ Object



10
11
12
# File 'lib/mongo_mapper/extensions/array.rb', line 10

def from_mongo(value)
  value || []
end

#to_mongo(value) ⇒ Object



5
6
7
8
# File 'lib/mongo_mapper/extensions/array.rb', line 5

def to_mongo(value)
  value = value.respond_to?(:lines) ? value.lines : value
  value.to_a
end