The Style/DeprecatedHashMethods cop says, that has_key? is deprecated in favor of key?, citing a four year old message from @matz: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/43765
The ruby 2.3.1 documentation does not mention the deprecation and has_key? is mentioned all over the place, even as example for key?: http://ruby-doc.org/core-2.3.1/Hash.html#method-i-key-3F
So is this really deprecated?
Looking at the doc and source, seems like key? is just an alias of has_key?. Similarly value? is an alias of has_value?.
If Matz said it is deprecated, we should assume it won't be in Ruby 3. The only thing missing is a note in the Ruby documentation.
Although I prefer key? and recommend to use it over has_key?, it is not going to be removed, even in Ruby3.
Most helpful comment
Although I prefer
key?and recommend to use it overhas_key?, it is not going to be removed, even in Ruby3.