Issue #16697 has been reported by Eregon (Benoit Daloze).

----------------------------------------
Bug #16697: Hash.ruby2_keywords_hash?(value) should support any object
https://bugs.ruby-lang.org/issues/16697

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Target version: 2.8
* ruby -v: ruby 2.8.0dev (2020-02-28T14:32:56Z master f7be85a2b7) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
But currently it raises, which makes it needlessly inconvenient to use:
```ruby
> Hash.ruby2_keywords_hash?({})
=> false
> Hash.ruby2_keywords_hash?("hello")
Traceback (most recent call last):
        5: from /home/eregon/.rubies/ruby-trunk/bin/irb:23:in `<main>'
        4: from /home/eregon/.rubies/ruby-trunk/bin/irb:23:in `load'
        3: from /home/eregon/prefix/ruby-trunk/lib/ruby/gems/2.8.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
        2: from (irb):4
        1: from (irb):4:in `ruby2_keywords_hash?'
TypeError (wrong argument type String (expected Hash))
```

See https://github.com/ruby/ruby/pull/2966/files#r394741112 for a motivating example.

I'd like to suggest backporting this to 2.7 too.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>