From: vimal Date: 2009-02-16T21:20:03+09:00 Subject: Hash :: Recursive traversing and stripping the values Hi, I am a Ruby Newbie. I wrote a function for stripping all the values(a recursive one if it is a nested hash) but i almost end up in an error suggesting "Error => in `strip_hash_values': stack level too deep (SystemStackError)". Can someone help me with this. ------------------------------------------- Here's the code: ------------------------------------------- def strip_hash_values(hash) hash.each do |k, v| if v.class == String hash[k] == v.strip! elsif v.class == Array v.each do |vv| vv.strip! end elsif v.class == Hash strip_hash_values(hash) end end end Thanx, Vimal Das