RecursiveStruct
A gem to create recursive open structs.
Installation
Add this line to your application's Gemfile:
gem 'recursive_struct'
And then execute:
$ bundle
Or install it yourself as:
$ gem install recursive_struct
Usage
Passing a hash into the initializer will create an open struct that has all nested getter and setter methods.
hash = { a: { b: true }, c: false }
struct = RecursiveStruct.new(hash}
struct.a # #<RecursiveStruct b=true>
struct.a.b # true
struct.c # false
Contributing
- Fork it ( https://github.com/pboksz/recursive_struct/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request