SyntaxFix
Write A Post
Hire A Developer
Questions
You can always use Hash#key? to check if the key is present in a hash or not.
Hash#key?
If not it will return you false
false
hash = { one: 1, two:2 } hash.key?(:one) #=> true hash.key?(:four) #=> false