{"id":21429979,"url":"https://github.com/mblumtritt/invariable","last_synced_at":"2025-08-08T17:37:15.940Z","repository":{"id":56877872,"uuid":"441980933","full_name":"mblumtritt/invariable","owner":"mblumtritt","description":"The Invariable data class for Ruby.","archived":false,"fork":false,"pushed_at":"2022-12-27T17:42:07.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-25T10:20:32.496Z","etag":null,"topics":["data-structures","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mblumtritt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-26T20:47:46.000Z","updated_at":"2021-12-28T21:33:44.000Z","dependencies_parsed_at":"2023-01-31T04:46:09.417Z","dependency_job_id":null,"html_url":"https://github.com/mblumtritt/invariable","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/mblumtritt%2Finvariable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Finvariable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Finvariable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Finvariable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mblumtritt","download_url":"https://codeload.github.com/mblumtritt/invariable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243940062,"owners_count":20372044,"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-structures","ruby","ruby-gem"],"created_at":"2024-11-22T22:19:59.012Z","updated_at":"2025-03-16T21:44:32.104Z","avatar_url":"https://github.com/mblumtritt.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Invariable\n\nAn Invariable bundles a number of read-only attributes.\nIt can be used like a Hash as well as an Array. It supports subclassing and pattern matching.\n\nAn Invariable can be created explicitly as a Class like a Struct. Or existing classes can easily be extended to an Invariable.\n\n- Gem: [rubygems.org](https://rubygems.org/gems/invariable)\n- Source: [github.com](https://github.com/mblumtritt/invariable)\n- Help: [rubydoc.info](https://rubydoc.info/gems/invariable)\n\n## Sample\n\n```ruby\nrequire 'invariable'\n\nclass Person\n  include Invariable\n  attributes :name, :last_name\n  attribute address: Invariable.new(:city, :zip, :street)\n\n  def full_name\n    \"#{name} #{last_name}\"\n  end\nend\n...\njohn = Person.new(name: 'John', last_name: 'Doe')\njohn.full_name #=\u003e \"John Doe\"\njohn.address.city #=\u003e nil\njohn = john.update(\n  address: { street: '123 Main St', city: 'Anytown', zip: '45678' }\n)\njohn.dig(:address, :city) #=\u003e \"Anytown\"\n\n```\n\nFor more samples see [the samples dir](./examples)\n\n## Installation\n\nUse [Bundler](http://gembundler.com/) to use Invariiable in your own project:\n\nInclude in your `Gemfile`:\n\n```ruby\ngem 'invariable'\n```\n\nand install it by running Bundler:\n\n```bash\nbundle\n```\n\nTo install the gem globally use:\n\n```bash\ngem install invariable\n```\n\nAfter that you need only a single line of code in your project to have all tools on board:\n\n```ruby\nrequire 'invariable'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Finvariable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmblumtritt%2Finvariable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Finvariable/lists"}