class Hashery::PathHash

A PathHash is a hash whose values can be accessed in the normal manner, or with keys that are slash (‘/`) separated strings. To get the whole hash as a single flattened level, call `#flat`. All keys are converted to strings. All end-of-the-chain values are kept in whatever value they are.

s = PathHash['a' => 'b', 'c' => {'d' => :e}]
s['a'] #=> 'b'
s['c'] #=> {slashed: 'd'=>:e}
s['c']['d'] #=> :e
s['c/d'] #=> :e

PathHash is derived from the SlashedHash class in the HashMagic project by Daniel Parker <gems@behindlogic.com>.

Copyright © 2006 BehindLogic (hash_magic.rubyforge.org)

Authors: Daniel Parker

TODO: This class is very much a work in progess and will be substantially rewritten for future versions.