Closed notramo closed 7 months ago
Enums can't be used in union types, so the best we could do now would probably be to convert those to the corresponding integer values.
What about converting it to a tuple with value
and name
?
Tuples are not ideal to deal with in templates, but a special "wrapper" object giving access to the integer value and enum name would be an option.
Even better, then the #to_s
method could be used for name, and #value
for the numeric value.
I can try to implement it, where should I start?
Sorry @notramo I forgot to assign myself and I actually started looking into this after posting my previous message. The feature was added in 4c9139b.
It's not possible to use enums in templates, as enums can not include modules, and template values require
Marten::Template::Object
to be included. Maybe some automatic conversion could help with this.