Enumancer provides a declarative, type-safe registry for named values in Ruby.
Each entry is unique by both name and value. Optional type constraints and strict mode are supported.
Designed for predictable access, JSON serialization, and clean integration into Ruby applications.
Add this line to your Gemfile:
gem 'enumancer'Then install:
bundle installOr install it directly:
gem install enumancerclass Status < Enumancer::Enum
type Integer, strict: true
entry :draft, 0
entry :published, 1
entry :archived, 2
end
Status[:draft].value # => 0
Status.published.to_sym # => :published
Status.from_json('{"name":"archived"}') # => Status.archivedStatus.draft.to_json
# => '{"name":"draft","value":0}'Status.from_json('{"name":"published"}')
# => Status.published