Class: BSON::Document

Inherits:
Object
  • Object
show all
Defined in:
build/mongoid-6.1/lib/mongoid/extensions.rb

Instance Method Summary collapse

Instance Method Details

#transform_keysObject

We need to override this as ActiveSupport creates a new Object, instead of a new Hash see github.com/rails/rails/commit/f1bad130d0c9bd77c94e43b696adca56c46a66aa



15
16
17
18
19
20
21
22
# File 'build/mongoid-6.1/lib/mongoid/extensions.rb', line 15

def transform_keys
  return enum_for(:transform_keys) unless block_given?
  result = {}
  each_key do |key|
    result[yield(key)] = self[key]
  end
  result
end