{"action":"created","issue":{"url":"https://api.github.com/repos/dry-rb/dry-types/issues/271","repository_url":"https://api.github.com/repos/dry-rb/dry-types","labels_url":"https://api.github.com/repos/dry-rb/dry-types/issues/271/labels{/name}","comments_url":"https://api.github.com/repos/dry-rb/dry-types/issues/271/comments","events_url":"https://api.github.com/repos/dry-rb/dry-types/issues/271/events","html_url":"https://github.com/dry-rb/dry-types/issues/271","id":353171443,"node_id":"MDU6SXNzdWUzNTMxNzE0NDM=","number":271,"title":"Support for extra data in enums","user":{"login":"DamirSvrtan","id":1437202,"node_id":"MDQ6VXNlcjE0MzcyMDI=","avatar_url":"https://avatars0.githubusercontent.com/u/1437202?v=4","gravatar_id":"","url":"https://api.github.com/users/DamirSvrtan","html_url":"https://github.com/DamirSvrtan","followers_url":"https://api.github.com/users/DamirSvrtan/followers","following_url":"https://api.github.com/users/DamirSvrtan/following{/other_user}","gists_url":"https://api.github.com/users/DamirSvrtan/gists{/gist_id}","starred_url":"https://api.github.com/users/DamirSvrtan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DamirSvrtan/subscriptions","organizations_url":"https://api.github.com/users/DamirSvrtan/orgs","repos_url":"https://api.github.com/users/DamirSvrtan/repos","events_url":"https://api.github.com/users/DamirSvrtan/events{/privacy}","received_events_url":"https://api.github.com/users/DamirSvrtan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-23T00:15:11Z","updated_at":"2019-03-18T11:24:21Z","closed_at":"2019-03-18T11:24:21Z","author_association":"NONE","body":"Hello! 👋 \r\n\r\nI've been looking at the enum documentation and have been wondering wether there's an option to add some kind of behavior or extra attributes to enums? \r\n\r\nI'm talking about something similar to this: https://github.com/infinum/enumerations#advanced-usage"},"comment":{"url":"https://api.github.com/repos/dry-rb/dry-types/issues/comments/473871541","html_url":"https://github.com/dry-rb/dry-types/issues/271#issuecomment-473871541","issue_url":"https://api.github.com/repos/dry-rb/dry-types/issues/271","id":473871541,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3Mzg3MTU0MQ==","user":{"login":"solnic","id":1066,"node_id":"MDQ6VXNlcjEwNjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1066?v=4","gravatar_id":"","url":"https://api.github.com/users/solnic","html_url":"https://github.com/solnic","followers_url":"https://api.github.com/users/solnic/followers","following_url":"https://api.github.com/users/solnic/following{/other_user}","gists_url":"https://api.github.com/users/solnic/gists{/gist_id}","starred_url":"https://api.github.com/users/solnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solnic/subscriptions","organizations_url":"https://api.github.com/users/solnic/orgs","repos_url":"https://api.github.com/users/solnic/repos","events_url":"https://api.github.com/users/solnic/events{/privacy}","received_events_url":"https://api.github.com/users/solnic/received_events","type":"User","site_admin":false},"created_at":"2019-03-18T11:24:21Z","updated_at":"2019-03-18T11:24:21Z","author_association":"MEMBER","body":"All types support meta data via `Type#meta` so you can do this:\r\n\r\n``` ruby\r\nrequire 'dry/types'\r\n\r\nmodule Types\r\n  include Dry::Types.module\r\nend\r\n\r\nStatus = Types::Strict::Symbol\r\n  .enum(0 => :draft, 1 => :published)\r\n  .meta(draft: 'a draft article', published: 'a published article')\r\n\r\nputs Status.inspect\r\n# #<Dry::Types[Enum<Constrained<Definition<Symbol>\r\n#   rule=[type?(Symbol) AND included_in?([0, 1])]>\r\n#   mapping={0=>:draft, 1=>:published}\r\n#   meta={draft: \"a draft article\", published: \"a published article\"}>]>\r\n\r\nputs Status.meta[:draft]\r\n# \"a draft article\"\r\n\r\nputs Status.meta[:published]\r\n# \"a published article\"\r\n```"}}
{"actor":{"display_login":"solnic"}}