Enuminator is a EnumerateIt Extension
Enumerations for Ruby or Rails inspired in EnumerateIt with some magic powers! 🎩
Installation
gem install enuminator
Using with Rails
bundle add enuminator
Generators
You can use a Rails generator to create ApplicationEnumeration
, because you need this main class to use enumerations:
bin/rails g enuminator:install
This command will create this file:
# /app/enumerations/application_controller.rb
class ApplicationEnumeration < Enuminator::Base
end
You can use a Rails generator to create a specific enumeration:
bin/rails g enuminator:enum relationship_status single married divorced
This command will create this file:
# /app/enumerations/application_controller.rb
class RelationshipStatus < ApplicationEnumeration
associate_values(:single, :married, :divorced)
end
From now you could follow the EnumerateIt references =)
EnumerateIt References
Contributing
Bug reports and merge requests are welcome on GitHub at https://github.com/[USERNAME]/enuminator.