Permalink
Browse files

PERF: more Hash + map changes

  • Loading branch information...
1 parent 42fad8c commit 5836af8f8b0eb3c569c66792abf50a0485bb6f22 @spastorino spastorino committed Oct 3, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -158,9 +158,9 @@ def inherited_with_inheritable_attributes(child)
if inheritable_attributes.equal?(EMPTY_INHERITABLE_ATTRIBUTES)
new_inheritable_attributes = EMPTY_INHERITABLE_ATTRIBUTES
else
- new_inheritable_attributes = inheritable_attributes.inject({}) do |memo, (key, value)|
- memo.update(key => value.duplicable? ? value.dup : value)
- end
+ new_inheritable_attributes = Hash[inheritable_attributes.map do |(key, value)|
+ [key, value.duplicable? ? value.dup : value]
+ end]
end
child.instance_variable_set('@inheritable_attributes', new_inheritable_attributes)

0 comments on commit 5836af8

Please sign in to comment.