{"id":18319780,"url":"https://github.com/redding/enumeration","last_synced_at":"2025-04-05T22:31:37.076Z","repository":{"id":59153627,"uuid":"1572480","full_name":"redding/enumeration","owner":"redding","description":"add enumerated value attributes to your ruby classes","archived":false,"fork":false,"pushed_at":"2016-06-18T03:03:26.000Z","size":28,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T14:57:53.156Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redding.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":"2011-04-05T15:01:19.000Z","updated_at":"2019-02-27T09:32:10.000Z","dependencies_parsed_at":"2022-09-13T11:01:23.847Z","dependency_job_id":null,"html_url":"https://github.com/redding/enumeration","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/redding%2Fenumeration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fenumeration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fenumeration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fenumeration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redding","download_url":"https://codeload.github.com/redding/enumeration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411236,"owners_count":20934650,"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-11-05T18:14:13.965Z","updated_at":"2025-04-05T22:31:36.674Z","avatar_url":"https://github.com/redding.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enumeration\n\nAdd enumerated value attributes to your ruby classes.\n\n## Usage\n\n```ruby\nrequire 'enumeration'\n\nclass Thing\n  include Enumeration\n\n  # list enumeration\n  enum :word, %w{aye bee see}\n\n  # map enumeration\n  enum :stuff, {\n    :a =\u003e \"aye\",\n    :b =\u003e \"bee\",\n    :c =\u003e \"see\"\n  }\nend\n\n# get the enum sets\nThing.word_set      # =\u003e ['aye', 'bee', 'see']\nThing.stuff_set     # =\u003e [:a, :b, :c]\n\n# lookup mapped enum values\nThing.stuff(:a)     # =\u003e \"aye\"\n\n\nt = Thing.new\n\n# write list enum values\nt.word              # =\u003e nil\nt.word = \"aye\"\nt.word              # =\u003e \"aye\"\nt.word_key          # =\u003e \"aye\" (a list's 'keys' are it's values, vice-versa)\nt.word = \"dee\"\nt.word              # =\u003e nil  (won't write non enum values)\nt.word_key          # =\u003e nil\n\n# write mapped enum value\nt.stuff             # =\u003e nil\nt.stuff = :b        #    (write using key)\nt.stuff             # =\u003e \"bee\"\nt.stuff_key         # =\u003e :b\nt.stuff = \"see\"     #    (write using value)\nt.stuff             # =\u003e \"see\"\nt.stuff_key         # =\u003e :c\nt.stuff = :d\nt.stuff             # =\u003e nil (won't write non enum keys)\nt.stuff_key         # =\u003e nil\nt.stuff = \"dee\"\nt.stuff             # =\u003e nil (won't write non enum values)\nt.stuff_key         # =\u003e nil\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'enumeration'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install enumeration\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fenumeration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredding%2Fenumeration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fenumeration/lists"}