Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo_odm/core_ext/conversions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.type_cast(value) ⇒ Object



57
58
59
60
# File 'lib/mongo_odm/core_ext/conversions.rb', line 57

def self.type_cast(value)
  return nil if value.nil?
  value.to_a.map {|elem| MongoODM.instanciate(elem)}
end

Instance Method Details

#dereferenceObject



66
67
68
# File 'lib/mongo_odm/core_ext/conversions.rb', line 66

def dereference
  MongoODM.instanciate(self.map{|value| MongoODM.dereference(value)})
end

#to_mongoObject



62
63
64
# File 'lib/mongo_odm/core_ext/conversions.rb', line 62

def to_mongo
  self.map {|elem| elem.to_mongo}
end