DEV Community

Discussion on: A trick with Ruby array literals

Collapse
 
rhymes profile image
rhymes

Interesting trick to create enums values on the fly, though I guess those are variables not constants, but maybe one can sneak a .freeze inline 😂

Collapse
 
nflamel profile image
Fran C.

Sure! Nothing is really constant in Ruby... you can even use symbols if they fit your need.