From: Todd Benson Date: 2008-03-05T18:45:23+09:00 Subject: Re: Newbea question again? On Wed, Mar 5, 2008 at 2:53 AM, Ibrahim Dogru wrote: > > > @b = false > > def check h, key > > h.each { |k, h| @b ||= h.keys.include?(key) || check(h, key) rescue > > false; @b} > > end > > > hsh = YAML.load_file("your_file.yml") > > puts check(hsh, "template_of_roster") > > puts check(hsh, "template_of_roster3") > > > => false > > => true > > > If your hashes are not nested (i.e. you have one level that you are > > concerned about), then all you should just use use > > h["template1"].keys.include? > > > hth, > > > thank you very much.. After looking at the documentation, I guess you can simply replace... #keys.include? ...with... #has_key? Todd