diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash/transform_values.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/transform_values.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/transform_values.rb b/activesupport/lib/active_support/core_ext/hash/transform_values.rb index 7d507ac998..4b19c9fc1f 100644 --- a/activesupport/lib/active_support/core_ext/hash/transform_values.rb +++ b/activesupport/lib/active_support/core_ext/hash/transform_values.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Hash # Returns a new hash with the results of running +block+ once for every value. # The keys are unchanged. @@ -16,7 +18,7 @@ class Hash result[key] = yield(value) end result - end + end unless method_defined? :transform_values # Destructively converts all values using the +block+ operations. # Same as +transform_values+ but modifies +self+. @@ -25,5 +27,6 @@ class Hash each do |key, value| self[key] = yield(value) end - end + end unless method_defined? :transform_values! + # TODO: Remove this file when supporting only Ruby 2.4+. end |