Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Hash object with struct access
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.rbenv-version
Gemfile
LICENSE
README.md
Rakefile
hash_with_struct_access.gemspec

README.md

Hash object with struct access. Main purpose is to be a configuration object.

Warning: It can't be modified after initialization.

# Simple example
hash = HashWithStructAccess.new(:foo => {:bar => 42})
hash.foo #=> {:bar => 42}
hash.foo.bar #=> 42

# More complex example
hash = HashWithStructAccess.new(:foo => {(o = Object.new) => {"bar" => {1 => :baz}}})
hash.foo #=> {o => {"bar" => {1 => :baz}}}
hash.foo[o] #=> {"bar" => {1 => :baz}}
hash.foo[o].bar #=> {1 => :baz}
hash.foo[o].bar[1] #=> :baz
Something went wrong with that request. Please try again.