module Mongoid::Extensions::Set::ClassMethods

Public Instance Methods

demongoize(object) click to toggle source

Convert the object from its mongo friendly ruby type to this type.

@example Demongoize the object.

Set.demongoize({ "min" => 1, "max" => 5 })

@param [ Hash ] object The object to demongoize.

@return [ Set ] The set.

@since 3.0.0

# File lib/mongoid/extensions/set.rb, line 31
def demongoize(object)
  ::Set.new(object)
end
mongoize(object) click to toggle source

Turn the object from the ruby type we deal with to a Mongo friendly type.

@example Mongoize the object.

Set.mongoize(1..3)

@param [ Set ] object The object to mongoize.

@return [ Hash ] The object mongoized.

@since 3.0.0

# File lib/mongoid/extensions/set.rb, line 46
def mongoize(object)
  object.to_a
end