Class | Choice::LazyHash |
In: |
lib/choice/lazyhash.rb
|
Parent: | Hash |
This class lets us get away with really bad, horrible, lazy hash accessing. Like so:
hash = LazyHash.new hash[:someplace] = "somewhere" puts hash[:someplace] puts hash['someplace'] puts hash.someplace
If you‘d like, you can pass in a current hash when initializing to convert it into a lazyhash. Or you can use the .to_lazyhash method attached to the Hash object (evil!).
store | -> | old_store |
Keep the old methods around. | ||
fetch | -> | old_fetch |