The Elements of Style in Ruby #9: Hash#has_key? and Hash#has_value? are deprecated

One can often find similar code in the wild:


has_something? predicates are not idiomatic in Ruby and Hash#has_key? and Hash#has_value? are nothing, but remnants of the early days of Ruby. In fact, according to Matz, they are deprecated in favor of Hash#key? and Hash#value?.

The above snippet should look like:


As usual - you can use RuboCop to identify and fix such shortfalls of your code.