Skip to content

spraints/auto_hash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Easily build nested hashes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages