aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2016-10-25 21:59:17 -0500
committerGitHub <noreply@github.com>2016-10-25 21:59:17 -0500
commit634741d9721eb938c8bce38c109023178268e43d (patch)
tree16e83cfa300bd836f2c061fc421d1e91bd172908
parentc0e656fe40afbec5fe5851074515273303a942e7 (diff)
parentc51a9b975f152ac6ff64514320fd33ae2c2c442f (diff)
downloadrails-634741d9721eb938c8bce38c109023178268e43d.tar.gz
rails-634741d9721eb938c8bce38c109023178268e43d.tar.bz2
rails-634741d9721eb938c8bce38c109023178268e43d.zip
Merge pull request #26895 from yui-knk/use_same_class_on_transform_values
Ensure `#transform_values` of HWIDA to return HWIDA
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb
index 7ecc5c19bd..d3bb5496bf 100644
--- a/activesupport/lib/active_support/hash_with_indifferent_access.rb
+++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -273,6 +273,11 @@ module ActiveSupport
dup.tap { |hash| hash.reject!(*args, &block) }
end
+ def transform_values(*args, &block)
+ return to_enum(:transform_values) unless block_given?
+ dup.tap { |hash| hash.transform_values!(*args, &block) }
+ end
+
# Convert to a regular hash with string keys.
def to_hash
_new_hash = Hash.new