O'Reilly logo
  • Ronald Cosentino thinks this is interesting:

And last but not least, you can use some brand-new hash methods, has_key? and has_value?, to check whether a hash contains a certain key or value:

>> our_heroes.has_key?(:ruben)
=> true
>> our_heroes.has_key?(:trady_blix)
=> false
>> our_heroes.has_value?('a fry cook at the Hashery')
=> true


Cover of Ruby Wizardry


has_key (:ruben)