Open palexander opened 11 years ago
In
UserRole.default
How do we know which enum instance is default
? do we need an option for that like:
class UserRole
enum_values :administrator, :librarian, :developer, :default => :librarian
end
Yes, UserRole.default is just a hard-coded method with the default value, so if we want that functionality in the DSL then it would make sense to have an option available
Handle Java-style enum objects that allow for a definition of allowed values that get created automatically on first access with a static flag to avoid recreating the values again.
For retrieving, two possible syntax options:
Or get rid of new (by making initialize private) and find and use one method per enum value: