{"id":22725448,"url":"https://github.com/delonnewman/hash_delegator","last_synced_at":"2025-03-29T23:42:31.354Z","repository":{"id":56875933,"uuid":"335773721","full_name":"delonnewman/hash_delegator","owner":"delonnewman","description":"Thread-safe immutable objects that provide delegation and basic validation to hashes.","archived":false,"fork":false,"pushed_at":"2021-06-17T00:19:17.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T12:35:02.757Z","etag":null,"topics":["data-oriented","data-oriented-programming","data-structures","fp","functional-programming","hash","hashmap","immutable","immutable-datastructures","object-oriented-programming","oop","ruby","ruby-gems"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/delonnewman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-03T22:35:06.000Z","updated_at":"2022-03-09T01:53:22.000Z","dependencies_parsed_at":"2022-08-20T10:11:02.102Z","dependency_job_id":null,"html_url":"https://github.com/delonnewman/hash_delegator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delonnewman%2Fhash_delegator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delonnewman%2Fhash_delegator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delonnewman%2Fhash_delegator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delonnewman%2Fhash_delegator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/delonnewman","download_url":"https://codeload.github.com/delonnewman/hash_delegator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246258862,"owners_count":20748573,"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-oriented","data-oriented-programming","data-structures","fp","functional-programming","hash","hashmap","immutable","immutable-datastructures","object-oriented-programming","oop","ruby","ruby-gems"],"created_at":"2024-12-10T16:10:45.058Z","updated_at":"2025-03-29T23:42:31.328Z","avatar_url":"https://github.com/delonnewman.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/delonnewman/hash_delegator.svg?branch=master)](https://travis-ci.com/delonnewman/hash_delegator)\n\n# HashDelegator\n\nThread-safe immutable objects that provide delegation and basic validation to hashes.\n\n## Synopsis\n\n```ruby\nclass Person \u003c HashDelegator\n  required :first_name, :last_name\n  transform_keys(\u0026:to_sym)\n\n  def name\n    \"#{first_name} #{last_name}\"\n  end\nend\n\nperson = Person.new(first_name: \"Mary\", last_name: \"Lamb\", age: 32)\nperson.age # =\u003e 32\nperson.name # =\u003e \"Mary Lamb\"\n\n# it supports all non-mutating methods of Hash\nperson.merge!(favorite_food: \"Thai\") # =\u003e NoMethodError\nperson.merge(favorite_food: \"Thai\") # =\u003e #\u003cPerson { first_name: \"Mary\", last_name: \"Lamb\", age: 32 }\u003e\n\n# respects inheritance\nclass Employee \u003c Person\n  required :employee_id\nend\n\nEmployee.new(age: 32, employee_id: 1234) # =\u003e Error, first_name attribute is required\nEmployee.new(first_name: \"John\", last_name: \"Smith\", age: 23, employee_id: 3456) # =\u003e #\u003cEmployee ...\u003e\n```\n\n## Why?\n\nBecause generality...\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'hash_delegator'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install hash_delegator\n\n## See Also\n\n- [Dry Struct](https://dry-rb.org/gems/dry-struct)\n- [Clojure Records](https://clojure.org/reference/datatypes#_deftype_and_defrecord)\n- [Delegator](https://rubyapi.org/3.0/o/delegator)\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelonnewman%2Fhash_delegator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelonnewman%2Fhash_delegator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelonnewman%2Fhash_delegator/lists"}