BetterOpenStruct is a subclass of OpenStruct that recursively wraps attribute hashes in an OpenStruct.
Add this line to your application's Gemfile:
gem 'better_open_struct'
And then execute:
$ bundle
Or install it yourself as:
$ gem install better_open_struct
bos = BetterOpenStruct.new(:foo => { :bar => [ {:baz => 'some value'} ] })
can now be accessed in the following manner:
bos.foo.bar.first.baz # 'some value'
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request