Class: BSON::Document

Inherits:
Object
  • Object
show all
Defined in:
build/mongoid-master/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



13
14
15
16
17
18
19
20
# File 'build/mongoid-master/lib/mongoid/extensions.rb', line 13

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