Merge pull request #46943 from jonathanhefner/hwia-default-match-hash-default-arity

Match arity of `Hash#default` in `HWIA#default`
This commit is contained in:
Jonathan Hefner 2023-01-09 17:00:42 -06:00 committed by GitHub
commit fa11789d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -218,11 +218,11 @@ module ActiveSupport
# hash.default # => nil
# hash.default('foo') # => 'foo'
# hash.default(:foo) # => 'foo'
def default(*args)
if args.length == 1
super(convert_key(args[0]))
def default(key = (no_key = true))
if no_key
super()
else
super(*args.map { |arg| convert_key(arg) })
super(convert_key(key))
end
end