diff options
author | Erik Michaels-Ober <sferik@gmail.com> | 2014-07-12 16:44:25 +0200 |
---|---|---|
committer | Erik Michaels-Ober <sferik@gmail.com> | 2014-07-12 17:42:01 +0200 |
commit | e167389e1f2fc577e0d3cb645804d012aee2e89d (patch) | |
tree | 44b14c170020357f16cc4f53a3233065e04a7282 /activesupport | |
parent | 073397cf5b2ed525f817d06fb9922c147f136860 (diff) | |
download | rails-e167389e1f2fc577e0d3cb645804d012aee2e89d.tar.gz rails-e167389e1f2fc577e0d3cb645804d012aee2e89d.tar.bz2 rails-e167389e1f2fc577e0d3cb645804d012aee2e89d.zip |
Don't construct a Proc if no block is given
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/transform_values.rb | 2 |
1 files changed, 1 insertions, 1 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 6ff7e91212..cebf9e815a 100644 --- a/activesupport/lib/active_support/core_ext/hash/transform_values.rb +++ b/activesupport/lib/active_support/core_ext/hash/transform_values.rb @@ -4,7 +4,7 @@ class Hash # # { a: 1, b: 2, c: 3 }.transform_values { |x| x * 2 } # # => { a: 2, b: 4, c: 6 } - def transform_values(&block) + def transform_values result = self.class.new each do |key, value| result[key] = yield(value) |