diff options
-rw-r--r-- | hash.c | 2 | ||||
-rw-r--r-- | spec/ruby/core/hash/to_proc_spec.rb | 4 |
2 files changed, 5 insertions, 1 deletions
@@ -5285,7 +5285,7 @@ hash_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(key, hash)) static VALUE rb_hash_to_proc(VALUE hash) { - return rb_func_proc_new(hash_proc_call, hash); + return rb_func_lambda_new(hash_proc_call, hash, 1, 1); } static VALUE diff --git a/spec/ruby/core/hash/to_proc_spec.rb b/spec/ruby/core/hash/to_proc_spec.rb index 8b7ddd5e00..73c96bdf08 100644 --- a/spec/ruby/core/hash/to_proc_spec.rb +++ b/spec/ruby/core/hash/to_proc_spec.rb @@ -29,6 +29,10 @@ describe "Hash#to_proc" do it "is a lambda" do @proc.should.lambda? end + + it "has an arity of 1" do + @proc.arity.should == 1 + end end it "raises ArgumentError if not passed exactly one argument" do |