From: andrew@... Date: 2014-09-19T18:01:17+00:00 Subject: [ruby-core:65128] [ruby-trunk - Feature #10177] Hash#has_key? and Hash#has_value? should be deprecated Issue #10177 has been updated by Andrew Vit. +1 for `has_key?` from me. It's more readable as natural English as pointed out earlier. `has_key?` is more clear because `key(value)` and `key?(key)` expect different arguments, so the names should be more clearly different. There is a common ruby idiom for `x? == !!x` as paired method names. In this case these are not at all similar. `has_key?` is less likely to conflict with other objects that define dynamic predicate methods, which is better for duck-typing dynamic `model.x?` objects when wrapping it with method_missing for example. (ActiveModel, ActiveSupport::StringInquirer are just a few examples.) This common use of predicate methods also has zero arity. ---------------------------------------- Feature #10177: Hash#has_key? and Hash#has_value? should be deprecated https://bugs.ruby-lang.org/issues/10177#change-48979 * Author: gogo tanaka * Status: Open * Priority: Normal * Assignee: * Category: lib * Target version: ---------------------------------------- I referred to this Matz's remark. http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/43765 And I agree with him, I supposed `Hash#has_key?` should be preferred over `Hash#key?`, so I replaced all of `Hash#has_key?` and `Hash#has_value?` in `lib/*` with `Hash#key?` and `Hash#value?` ---Files-------------------------------- Replace_Hash#has_something.PATCH (20.4 KB) -- https://bugs.ruby-lang.org/