{"id":13880099,"url":"https://github.com/mbj/anima","last_synced_at":"2025-04-04T14:05:26.105Z","repository":{"id":4612646,"uuid":"5756257","full_name":"mbj/anima","owner":"mbj","description":"Object initializer from attributes hash","archived":false,"fork":false,"pushed_at":"2021-06-27T17:49:30.000Z","size":140,"stargazers_count":173,"open_issues_count":5,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T13:06:10.201Z","etag":null,"topics":[],"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/mbj.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","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":"2012-09-10T21:36:56.000Z","updated_at":"2024-05-01T14:09:20.000Z","dependencies_parsed_at":"2022-08-06T17:16:01.372Z","dependency_job_id":null,"html_url":"https://github.com/mbj/anima","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Fanima","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Fanima/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Fanima/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Fanima/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbj","download_url":"https://codeload.github.com/mbj/anima/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190127,"owners_count":20898697,"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":[],"created_at":"2024-08-06T08:02:47.182Z","updated_at":"2025-04-04T14:05:26.080Z","avatar_url":"https://github.com/mbj.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"anima\n=====\n\n![CI](https://github.com/mbj/anima/workflows/CI/badge.svg)\n\nSimple library to declare read only attributes on value-objects that are initialized via attributes hash.\n\nInstallation\n------------\n\nInstall the gem `anima` via your preferred method.\n\nExamples\n--------\n\n```ruby\nrequire 'anima'\n\n# Definition\nclass Person\n  include Anima.new(:salutation, :firstname, :lastname)\nend\n\n# Every day operation\na = Person.new(\n  salutation: 'Mr',\n  firstname:  'Markus',\n  lastname:   'Schirp'\n)\n\n# Returns expected values\na.salutation # =\u003e \"Mr\"\na.firstname  # =\u003e \"Markus\"\na.lastname   # =\u003e \"Schirp\"\na.frozen?    # =\u003e false\n\nb = Person.new(\n  salutation: 'Mr',\n  firstname:  'John',\n  lastname:   'Doe'\n)\n\nc = Person.new(\n  salutation: 'Mr',\n  firstname:  'Markus',\n  lastname:   'Schirp'\n)\n\n# Equality based on attributes\na == b      # =\u003e false\na.eql?(b)   # =\u003e false\na.equal?(b) # =\u003e false\n\na == c      # =\u003e true\na.eql?(c)   # =\u003e true\na.equal?(c) # =\u003e false\n\n# Functional-style updates\nd = b.with(\n  salutation: 'Mrs',\n  firstname:  'Sue',\n)\n\n# It returns copies, no inplace modification\nd.equal?(b) # =\u003e false\n\n# Hash representation\nd.to_h # =\u003e { salutation: 'Mrs', firstname: 'Sue', lastname: 'Doe' }\n\n# Disallows initialization with incompatible attributes\n\nPerson.new(\n  # :saluatation key missing\n  \"firstname\" =\u003e \"Markus\", # does NOT coerce this by intention\n  :lastname   =\u003e \"Schirp\"\n) # raises Anima::Error with message \"Person attributes missing: [:salutation, :firstname], unknown: [\"firstname\"]\n```\n\nCredits\n-------\n\n* Markus Schirp \u003cmbj@schirp-dso.com\u003e\n\nContributing\n-------------\n\n* Fork the project.\n* Make your feature addition or bug fix.\n* Add tests for it. This is important so I don't break it in a\n  future version unintentionally.\n* Commit, do not mess with Rakefile or version\n  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)\n* Send me a pull request. Bonus points for topic branches.\n\nLicense\n-------\n\nCopyright (c) 2013 Markus Schirp\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbj%2Fanima","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbj%2Fanima","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbj%2Fanima/lists"}