Class: OpenHash
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- OpenHash
- Defined in:
- lib/open_hash.rb
Overview
OpenHash lets Hash called and assigned by the key in chainable way. Example:
person = OpenHash.new(name: "John", hometown: { city: "London" })
person.name #=> "John"
person.hometown.city #=> "London"
person = OpenHash.new
person.name = "Lion"
person.hometown.city = "Paris"
person.parents.father.name = "Heron"
person #=> { name: "Lion", hometown: { city: "Paris" }, parents: { father: { name: "Heron" } } }
Defined Under Namespace
Classes: BlackHole
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ OpenHash
constructor
A new instance of OpenHash.
-
#method_missing(name, *args) ⇒ Object
:nodoc:.