Replace Hash#has_key? with Hash#key?

1. Replace Hash#has_key? with Hash#key?
2. Replace Hash#has_value? with Hash#value?
This commit is contained in:
Leslie Zhang 2015-11-23 09:14:49 +08:00
parent a3ef58088e
commit e7dc56273f

View File

@ -230,8 +230,8 @@ new_hash = { defcon: 3, action: true }
new_hash.keys #=> [:defcon, :action]
# Check existence of keys and values in hash
new_hash.has_key?(:defcon) #=> true
new_hash.has_value?(3) #=> true
new_hash.key?(:defcon) #=> true
new_hash.value?(3) #=> true
# Tip: Both Arrays and Hashes are Enumerable
# They share a lot of useful methods such as each, map, count, and more