{"id":20764168,"url":"https://github.com/mickey/black-hole-struct","last_synced_at":"2025-04-30T08:11:43.001Z","repository":{"id":62554323,"uuid":"77801502","full_name":"mickey/black-hole-struct","owner":"mickey","description":":door: BlackHoleStruct is a data structure similar to an OpenStruct allowing autovivification","archived":false,"fork":false,"pushed_at":"2017-01-03T22:41:02.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T06:02:57.102Z","etag":null,"topics":["data-structure","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mickey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-01T23:36:52.000Z","updated_at":"2017-04-08T11:58:56.000Z","dependencies_parsed_at":"2022-11-03T04:46:02.841Z","dependency_job_id":null,"html_url":"https://github.com/mickey/black-hole-struct","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickey%2Fblack-hole-struct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickey%2Fblack-hole-struct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickey%2Fblack-hole-struct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickey%2Fblack-hole-struct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mickey","download_url":"https://codeload.github.com/mickey/black-hole-struct/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666307,"owners_count":21624295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-structure","ruby"],"created_at":"2024-11-17T10:49:02.581Z","updated_at":"2025-04-30T08:11:42.980Z","avatar_url":"https://github.com/mickey.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/mickey/black-hole-struct/tree/master.svg?style=svg)](https://circleci.com/gh/mickey/black-hole-struct/tree/master)\n\n# BlackHoleStruct\n\n**BlackHoleStruct** is a data structure similar to an `OpenStruct` that allows:\n- infinite chaining of attributes or [autovivification](https://en.wikipedia.org/wiki/Autovivification)\n- deep merging of BlackHoleStruct/Hash\n\n![](https://media.giphy.com/media/kxAX99ncvbPk4/giphy.gif)\n\n## Installation\n\nAdd it to your Gemfile:\n\n```ruby\ngem \"black_hole_struct\"\n```\n\nOr install the gem manually:\n\n```sh\n$ gem install black_hole_struct\n```\n\n## Basic Usage\n\n```ruby\nrequire \"black_hole_struct\"\n\nconfig = BlackHoleStruct.new\nconfig.dashboard.theme = \"white\"\nconfig.dashboard.time.from = \"now-1h\"\nconfig.dashboard.time.to = \"now\"\n\nputs config.dashboard.theme      # \"white\"\nputs config.dashboard.time       # #\u003cBlackHoleStruct :from=\"now-1h\" :to=\"now\"\u003e\nputs config.dashboard.time.from  # \"now-1h\"\n\nconfig[:connection][:host] = \"localhost\"\nconfig[:connection][:port] = 3000\n\nputs config.to_h\n# {\n#   connection: {\n#     host: \"localhost\",\n#     port: 3000\n#   }\n#   dashboard: {\n#     theme: \"white\",\n#     time: {\n#       from: \"now-1h\",\n#       to: \"now\"\n#     }\n#   }\n# }\n\nconfig = BlackHoleStruct.new(theme: \"white\", connection: {port: 3000})\nconfig.deep_merge!(connection: {host: 'localhost'})\nputs config.to_h\n# {\n#   connection: {\n#     host: \"localhost\",\n#     port: 3000\n#   }\n#   theme: \"white\"\n# }\n\n```\n\n## Is it any good\n\n[Yes](https://news.ycombinator.com/item?id=3067434)\n\n## Advanced usage\n\nCheck the [documentation](http://www.rubydoc.info/github/mickey/black-hole-struct/master/BlackHoleStruct).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickey%2Fblack-hole-struct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmickey%2Fblack-hole-struct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickey%2Fblack-hole-struct/lists"}