Module: Mongoid::Extensions::Hash::ClassMethods

Defined in:
lib/mongoid/extensions/hash.rb

Instance Method Summary collapse

Instance Method Details

#mongoize(object) ⇒ Hash

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

Examples:

Mongoize the object.

Hash.mongoize([ 1, 2, 3 ])

Parameters:

  • object (Object)

    The object to mongoize.

Returns:

  • (Hash)

    The object mongoized.

Since:

  • 3.0.0



199
200
201
202
# File 'lib/mongoid/extensions/hash.rb', line 199

def mongoize(object)
  return if object.nil?
  evolve(object).update_values { |value| value.mongoize }
end

#resizable?true

Can the size of this object change?

Examples:

Is the hash resizable?

{}.resizable?

Returns:

  • (true)

    true.

Since:

  • 3.0.0



212
213
214
# File 'lib/mongoid/extensions/hash.rb', line 212

def resizable?
  true
end