From: Robert Klemme Date: 2010-02-25T07:04:31+09:00 Subject: Re: Iterate over hash of nested hashes 2010/2/24 Jonathan Nielsen : >> >> def iteration obj >>  if obj.is_a? Hash >>    obj.each { |new_obj| iteration(new_obj) } >>  else >>     # It's not a hash, do stuff with it! >>  end >> end >> >> my_hash.each { |obj| iteration(obj) } >> > > Oops.  I fixed line 3 above :) You could also do def iter(h,&b) h.each do |k,v| case v when Hash iter(v,&b) else b[v] end end end iter my_hash do |obj| p obj end Although the disadvantage is that doing it this way the structure information cannot be evaluated in the block. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/