mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix arity of Hash#to_proc [Bug #12671]
This commit is contained in:
parent
f79dc8741f
commit
241244739f
Notes:
git
2020-07-30 01:10:38 +09:00
2 changed files with 5 additions and 1 deletions
2
hash.c
2
hash.c
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue