mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 07:12:31 +03:00
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:
parent
a3ef58088e
commit
e7dc56273f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user