https://github.com/aetherknight/recursive-open-struct
OpenStruct subclass that returns nested hash attributes as RecursiveOpenStructs
https://github.com/aetherknight/recursive-open-struct
Keywords
openstruct-subclass ruby
Keywords from Contributors
activerecord activejob mvc rubygem rspec feature-flag grape ruby-gem rack sidekiq
Last synced: about 19 hours ago
JSON representation
Repository metadata
OpenStruct subclass that returns nested hash attributes as RecursiveOpenStructs
- Host: GitHub
- URL: https://github.com/aetherknight/recursive-open-struct
- Owner: aetherknight
- License: other
- Created: 2010-01-12T11:14:06.000Z (over 16 years ago)
- Default Branch: main
- Last Pushed: 2026-04-19T00:49:26.000Z (12 days ago)
- Last Synced: 2026-04-26T02:11:14.366Z (5 days ago)
- Topics: openstruct-subclass, ruby
- Language: Ruby
- Homepage:
- Size: 243 KB
- Stars: 289
- Watchers: 10
- Forks: 54
- Open Issues: 4
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Authors: AUTHORS.txt
README.md
recursive-open-struct
OpenStruct subclass that returns nested hash attributes as
RecursiveOpenStructs.
Usage
It allows for hashes within hashes to be called in a chain of methods:
ros = RecursiveOpenStruct.new( { wha: { tagoo: 'siam' } } )
ros.wha.tagoo # => 'siam'
Also, if needed, nested hashes can still be accessed as hashes:
ros.wha_as_a_hash # { tagoo: 'siam' }
Optional: Recurse Over Arrays
RecursiveOpenStruct can also optionally recurse across arrays, although you
have to explicitly enable it.
Default behavior:
h = { :somearr => [ { name: 'a'}, { name: 'b' } ] }
ros = RecursiveOpenStruct.new(h)
ros.somearr # => [ { name: 'a'}, { name: 'b' } ]
Enabling recurse_over_arrays:
ros = RecursiveOpenStruct.new(h, recurse_over_arrays: true )
ros.somearr[0].name # => 'a'
ros.somearr[1].name # => 'b'
Optional: Preserve Original Keys
Also, by default it will turn all hash keys into symbols internally:
h = { 'fear' => 'is', 'the' => 'mindkiller' } }
ros = RecursiveOpenStruct.new(h)
ros.to_h # => { fear: 'is', the: 'mindkiller' }
You can preserve the original keys by enabling :preserve_original_keys:
h = { 'fear' => 'is', 'the' => 'mindkiller' } }
ros = RecursiveOpenStruct.new(h, preserve_original_keys: true)
ros.to_h # => { 'fear' => 'is', 'the' => 'mindkiller' }
Optional: Raise error on missing attribute
This option allows to raise an error if you try to call an attribute you didn't specify in hash
h = { 'fear' => 'is', 'the' => 'mindkiller' } }
ros = RecursiveOpenStruct.new(h, raise_on_missing: true)
ros.undefined # => undefined method `undefined' for #<RecursiveOpenStruct fear="is", the="mindkiller">
The default behaviour returns nil
h = { 'fear' => 'is', 'the' => 'mindkiller' } }
ros = RecursiveOpenStruct.new(h)
ros.undefined # => nil
Installation
Available as a gem in rubygems, the default gem repository.
If you use bundler, just add recursive-open-struct to your gemfile :
gem 'recursive-open-struct'
You may also install the gem manually:
gem install recursive-open-struct
Contributing
If you would like to file or fix a bug, or propose a new feature, please review
CONTRIBUTING first.
Supported Ruby Versions
Recursive-open-struct attempts to support just the versions of Ruby that are
still actively maintained. Once a given major/minor version of Ruby no longer
receives patches, they will no longer be supported (but recursive-open-struct
may still work). I usually update the travis.yml file to reflect this when
preparing for a new release or do some other work on recursive-open-struct.
I also try to update recursive-open-struct to support new features in
OpenStruct itself as new versions of Ruby are released. However, I don't
actively monitor the status of this, so a newer feature might not work. If you
encounter such a feature, please file a bug or a PR to fix it, and I will try
to cut a new release of recursive-open-struct quickly.
SemVer Compliance
Rescursive-open-struct follows SemVer
2.0 for its versioning.
Copyright
Copyright (c) 2009-2018, The Recursive-open-struct developers (given in the
file AUTHORS.txt). See LICENSE.txt for details.
Owner metadata
- Name: William (B.J.) Snow Orvis
- Login: aetherknight
- Email:
- Kind: user
- Description:
- Website: https://www.aedifice.org
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/62613?u=d3e4348cb1d930cbe7c622d67055e396597131a5&v=4
- Repositories: 20
- Last ynced at: 2023-04-10T12:01:28.274Z
- Profile URL: https://github.com/aetherknight
GitHub Events
Total
- Delete event: 1
- Pull request event: 6
- Watch event: 13
- Issue comment event: 1
- Push event: 9
- Create event: 3
Last Year
- Delete event: 1
- Pull request event: 6
- Issue comment event: 1
- Push event: 9
- Create event: 3
Committers metadata
Last synced: 12 days ago
Total Commits: 219
Total Committers: 31
Avg Commits per committer: 7.065
Development Distribution Score (DDS): 0.32
Commits in past year: 25
Committers in past year: 4
Avg Commits per committer in past year: 6.25
Development Distribution Score (DDS) in past year: 0.2
| Name | Commits | |
|---|---|---|
| William (B.J.) Snow Orvis | a****t@g****m | 149 |
| Offirmo | o****t@g****m | 12 |
| fervic | r****o@r****m | 11 |
| David Feldman | d****n@g****m | 6 |
| Kris Dekeyser | k****r@l****e | 5 |
| Maple Ong | m****g@g****m | 3 |
| Tom Chapin | t****n@g****m | 3 |
| Cédric Felizard | c****c@f****r | 2 |
| Hermann Mayer | h****2@g****m | 2 |
| Jean Boussier | j****r@g****m | 2 |
| Sebastian Gaul | s****n@m****m | 2 |
| Thiago Guimaraes | t****r@g****m | 2 |
| dependabot[bot] | 4****] | 2 |
| Richard Degenne | r****e@g****m | 1 |
| Victor Guzman | v****n@r****m | 1 |
| Ben Langfeld | b****n@l****e | 1 |
| Beni Cherniavsky-Paskin | c****n@r****m | 1 |
| Edward Betts | e****d@4****m | 1 |
| Ewoud Kohl van Wijngaarden | e****d@k****l | 1 |
| Federico Aloi | f****i@g****m | 1 |
| Hartley McGuire | s****l@g****m | 1 |
| Igor Victor | g****a@y****u | 1 |
| Ilya Umanets | i****s@s****m | 1 |
| Joe Rafaniello | j****e@r****m | 1 |
| Matt Culpepper | m****t@c****o | 1 |
| Matthew O'Riordan | m****n@g****m | 1 |
| Pedro Sena | s****o@g****m | 1 |
| Peter Yeremenko | p****o@g****m | 1 |
| Pirate Praveen | p****n@d****g | 1 |
| Richard Degenne | r****b@g****m | 1 |
| and 1 more... | ||
Committer domains:
- redhat.com: 2
- runawaybit.com: 2
- cleverlabs.io: 1
- debian.org: 1
- culpepper.co: 1
- sabiogroup.com: 1
- yandex.ru: 1
- kohlvanwijngaarden.nl: 1
- 4angle.com: 1
- langfeld.me: 1
- mgvmedia.com: 1
- felizard.fr: 1
- gusto.com: 1
- libis.be: 1
Issue and Pull Request metadata
Last synced: 12 days ago
Total issues: 41
Total pull requests: 48
Average time to close issues: 3 months
Average time to close pull requests: 4 months
Total issue authors: 33
Total pull request authors: 37
Average comments per issue: 2.88
Average comments per pull request: 2.48
Merged pull request: 35
Bot issues: 0
Bot pull requests: 2
Past year issues: 0
Past year pull requests: 7
Past year average time to close issues: N/A
Past year average time to close pull requests: 2 days
Past year issue authors: 0
Past year pull request authors: 4
Past year average comments per issue: 0
Past year average comments per pull request: 1.71
Past year merged pull request: 6
Past year bot issues: 0
Past year bot pull requests: 2
Top Issue Authors
- aetherknight (3)
- abonas (2)
- pravi (2)
- Kris-LIBIS (2)
- Nowaker (2)
- kke (2)
- mculp (2)
- jromigh (1)
- lilith (1)
- kubenstein (1)
- 31piy (1)
- banister (1)
- Richard-Degenne (1)
- agrare (1)
- wildmaples (1)
Top Pull Request Authors
- fervic (4)
- aetherknight (4)
- IlyaUmanets (2)
- dependabot[bot] (2)
- Kris-LIBIS (2)
- Richard-Degenne (2)
- wildmaples (2)
- faloi (1)
- SebastianVomMeer (1)
- yuri-zubov (1)
- jrafanie (1)
- pyeremenko (1)
- Offirmo (1)
- Nowaker (1)
- michaelachrisco (1)
Top Issue Labels
- bug (5)
- feature (3)
Top Pull Request Labels
- github_actions (2)
- dependencies (2)
Package metadata
- Total packages: 14
-
Total downloads:
- rubygems: 136,996,627 total
- Total docker downloads: 2,977,731,704
- Total dependent packages: 151 (may contain duplicates)
- Total dependent repositories: 1,799 (may contain duplicates)
- Total versions: 80
- Total maintainers: 4
gem.coop: recursive-open-struct
RecursiveOpenStruct is a subclass of OpenStruct. It differs from OpenStruct in that it allows nested hashes to be treated in a recursive fashion. For example: ros = RecursiveOpenStruct.new({ :a => { :b => 'c' } }) ros.a.b # 'c' Also, nested hashes can still be accessed as hashes: ros.a_as_a_hash # { :b => 'c' }
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Documentation: http://www.rubydoc.info/gems/recursive-open-struct/
- Licenses: MIT
- Latest release: 2.1.1 (published 12 days ago)
- Last Synced: 2026-04-19T01:03:26.953Z (12 days ago)
- Versions: 34
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 68,493,651 Total
- Docker Downloads: 1,488,865,852
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Docker downloads count: 0.065%
- Average: 0.12%
- Downloads: 0.417%
- Maintainers (2)
ubuntu-23.10: ruby-recursive-open-struct
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Licenses: other
- Latest release: 1.1.3-1 (published 3 months ago)
- Last Synced: 2026-03-13T19:24:42.673Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.814%
- Forks count: 1.567%
- Stargazers count: 1.689%
rubygems.org: recursive-open-struct
RecursiveOpenStruct is a subclass of OpenStruct. It differs from OpenStruct in that it allows nested hashes to be treated in a recursive fashion. For example: ros = RecursiveOpenStruct.new({ :a => { :b => 'c' } }) ros.a.b # 'c' Also, nested hashes can still be accessed as hashes: ros.a_as_a_hash # { :b => 'c' }
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Documentation: http://www.rubydoc.info/gems/recursive-open-struct/
- Licenses: MIT
- Latest release: 2.1.1 (published 12 days ago)
- Last Synced: 2026-04-19T17:01:08.332Z (11 days ago)
- Versions: 34
- Dependent Packages: 151
- Dependent Repositories: 1,799
- Downloads: 68,496,168 Total
- Docker Downloads: 1,488,865,852
-
Rankings:
- Docker downloads count: 0.087%
- Dependent packages count: 0.227%
- Downloads: 0.447%
- Dependent repos count: 0.735%
- Average: 1.439%
- Stargazers count: 3.485%
- Forks count: 3.655%
- Maintainers (2)
gem.coop: recursive-open-struct-sd
RecursiveOpenStruct is a subclass of OpenStruct. It differs from OpenStruct in that it allows nested hashes to be treated in a recursive fashion. For example: ros = RecursiveOpenStruct.new({ :a => { :b => 'c' } }) ros.a.b # 'c' Also, nested hashes can still be accessed as hashes: ros.a_as_a_hash # { :b => 'c' } > This is a fork of the original recursive-open-struct > to include a fix for https://github.com/aetherknight/recursive-open-struct/issues/46
- Homepage: http://github.com/aetherknight/recursive-open-struct
- Documentation: http://www.rubydoc.info/gems/recursive-open-struct-sd/
- Licenses: MIT
- Latest release: 1.0.2 (published over 9 years ago)
- Last Synced: 2026-04-17T22:01:48.270Z (13 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 3,404 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 28.412%
- Downloads: 85.237%
- Maintainers (2)
rubygems.org: recursive-open-struct-sd
RecursiveOpenStruct is a subclass of OpenStruct. It differs from OpenStruct in that it allows nested hashes to be treated in a recursive fashion. For example: ros = RecursiveOpenStruct.new({ :a => { :b => 'c' } }) ros.a.b # 'c' Also, nested hashes can still be accessed as hashes: ros.a_as_a_hash # { :b => 'c' } > This is a fork of the original recursive-open-struct > to include a fix for https://github.com/aetherknight/recursive-open-struct/issues/46
- Homepage: http://github.com/aetherknight/recursive-open-struct
- Documentation: http://www.rubydoc.info/gems/recursive-open-struct-sd/
- Licenses: MIT
- Latest release: 1.0.2 (published over 9 years ago)
- Last Synced: 2026-04-17T22:01:56.369Z (13 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 3,404 Total
-
Rankings:
- Stargazers count: 3.212%
- Forks count: 3.308%
- Dependent packages count: 15.706%
- Average: 31.251%
- Dependent repos count: 46.782%
- Downloads: 87.247%
- Maintainers (2)
debian-10: ruby-recursive-open-struct
- Homepage: http://github.com/aetherknight/recursive-open-struct
- Documentation: https://packages.debian.org/buster/ruby-recursive-open-struct
- Licenses: other
- Latest release: 1.1.0-1 (published 3 months ago)
- Last Synced: 2026-03-13T19:06:11.571Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-recursive-open-struct
- Homepage: http://github.com/aetherknight/recursive-open-struct
- Licenses:
- Latest release: 1.1.0-2 (published 3 months ago)
- Last Synced: 2026-03-13T14:24:55.617Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.04: ruby-recursive-open-struct
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Licenses:
- Latest release: 1.1.3-1 (published 3 months ago)
- Last Synced: 2026-03-11T19:18:29.230Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-24.10: ruby-recursive-open-struct
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Licenses:
- Latest release: 1.1.3-1 (published 3 months ago)
- Last Synced: 2026-03-09T18:22:14.849Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-recursive-open-struct
- Homepage: http://github.com/aetherknight/recursive-open-struct
- Documentation: https://packages.debian.org/bullseye/ruby-recursive-open-struct
- Licenses:
- Latest release: 1.1.1-1 (published 3 months ago)
- Last Synced: 2026-03-14T07:17:55.096Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-13: ruby-recursive-open-struct
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Documentation: https://packages.debian.org/trixie/ruby-recursive-open-struct
- Licenses:
- Latest release: 1.1.3-1 (published 3 months ago)
- Last Synced: 2026-03-14T18:08:10.132Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-22.04: ruby-recursive-open-struct
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Licenses:
- Latest release: 1.1.3-1 (published 3 months ago)
- Last Synced: 2026-03-13T23:37:26.332Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-recursive-open-struct
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Documentation: https://packages.debian.org/bookworm/ruby-recursive-open-struct
- Licenses:
- Latest release: 1.1.3-1 (published 3 months ago)
- Last Synced: 2026-03-13T23:45:06.880Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-24.04: ruby-recursive-open-struct
- Homepage: https://github.com/aetherknight/recursive-open-struct
- Licenses:
- Latest release: 1.1.3-1 (published 3 months ago)
- Last Synced: 2026-03-06T17:21:04.600Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- bundler >= 0 development
- pry >= 0 development
- rake >= 0 development
- rdoc >= 0 development
- rspec ~> 3.2 development
- simplecov >= 0 development
- actions/checkout v4 composite
- ruby/setup-ruby 943103cae7d3f1bb1e4951d5fcc7928b40e4b742 composite
Score: 30.973568492382356