Module: MongoMapper::Extensions::Set::ClassMethods

Defined in:
lib/mongo_mapper/extensions/set.rb

Instance Method Summary collapse

Instance Method Details

#from_mongo(value) ⇒ Object



19
20
21
# File 'lib/mongo_mapper/extensions/set.rb', line 19

def from_mongo(value)
  (value || []).to_set
end

#to_mongo(value, options = {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/mongo_mapper/extensions/set.rb', line 12

def to_mongo(value, options = {})
  recursive = options[:recursive]
  v = value.to_a
  v = v.to_mongo(options) if recursive
  v
end