From: Benjamin Fowl Date: 2011-01-18T19:05:47+09:00 Subject: Hash keys exist? Is there a way of checking whether a group of keys exist within a hash. For example you have the following hash example = {:profile => { :name => "John", :username => "johnny_bravo"}, :example1 => { :var1 => "test", :var2 => "test2" } } now all you want is a function that can be passed an array of required keys eg req = [:name, :username, :var1] this array can contain any number of required keys is not always just keys that are in either the profile or example1 sub hashes. I've looked at using the .keys method to compare keys but that requires me to specify where to look in the hash. Any help much apreciated -- Posted via http://www.ruby-forum.com/.