This commit is contained in:
Benoit Daloze 2020-07-28 20:39:27 +02:00
Родитель f79dc8741f
Коммит 241244739f
2 изменённых файлов: 5 добавлений и 1 удалений

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