Constants or class variables in ruby?

The main thing is that by using the CONSTANT notation, you're making it clear to the reader. the lower case, frozen string gives the impression is might be settable, forcing someone to go back and read the RDoc.


If these are really constant values that you define in source code and do not want to change during code execution then I would recommend to use constant.

If you plan to set and/or change these values dynamically during execution then use class variable with getters and setters.