Project

General

Profile

Actions

Bug #17197

closed

Some Hash methods still have arity 2 instead of 1

Added by marcandre (Marc-Andre Lafortune) 7 months ago. Updated 5 months ago.

Status:
Rejected
Priority:
Normal
Target version:
-
ruby -v:
ruby 3.0.0dev (2020-09-26T17:38:39Z master 950614b088)
[ruby-core:100192]

Description

Hash#each was changed recently to have arity of 1.
All other methods of Hash should behave the same.
Much has been fixed since #14015, but some remains:

# Some methods consistently have arity 2:
{a: 1}.select( &->(_kvp) {} ) # => ArgumentError (wrong number of arguments (given 2, expected 1))

All in all: %i[select keep_if delete_if reject to_h] have their arity still set at 2.


Related issues

Related to Ruby master - Bug #12706: Hash#each yields inconsistent number of argsClosedActions
Actions

Also available in: Atom PDF