Home > auto_hash

auto_hash

Auto_hash is a project mainly written in Ruby, it's free.

Easily build nested hashes

I saw this post about recursively setting deep hash values and thought it would be more awesome if it didn't create a big empty hash tree when you check to see if a key is there.

So, with AutoHash, you can do this:

thing = AutoHash.new
thing['fingers']['count'] = 5

But you can also do this:

thing = AutoHash.new
if thing['fingers']
  puts "Thing has #{thing['fingers']['count']} fingers."
else
  puts "Thing's fingers are not yet defined."
end
Previous:BSGUI