Module: Mongoid::Extensions::Set::ClassMethods

Defined in:
build/mongoid-7.3/lib/mongoid/extensions/set.rb

Instance Method Summary collapse

Instance Method Details

#demongoize(object) ⇒ Set

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

Examples:

Demongoize the object.

Set.demongoize([1, 2, 3])

Parameters:

  • object (Array)

    The object to demongoize.

Returns:

  • (Set)

    The set.

Since:

  • 3.0.0



33
34
35
# File 'build/mongoid-7.3/lib/mongoid/extensions/set.rb', line 33

def demongoize(object)
  ::Set.new(object)
end

#mongoize(object) ⇒ Array

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

Examples:

Mongoize the object.

Set.mongoize(Set.new([1,2,3]))

Parameters:

  • object (Set)

    The object to mongoize.

Returns:

  • (Array)

    The object mongoized.

Since:

  • 3.0.0



48
49
50
# File 'build/mongoid-7.3/lib/mongoid/extensions/set.rb', line 48

def mongoize(object)
  object.to_a
end