From e167389e1f2fc577e0d3cb645804d012aee2e89d Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sat, 12 Jul 2014 16:44:25 +0200 Subject: Don't construct a Proc if no block is given --- activesupport/lib/active_support/core_ext/hash/transform_values.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support') 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) -- cgit v1.2.3