Attr_reader for Class Variables in Ruby
First of all: This is a bad idea in general since you shouldn’t use class variables in ruby.
But just in case you ever need to use them and would like to access them using a getter method, this is how it can work:
1 2 3 4 5 6 7 8 9 |
|
This is a bit of magic and even has an eval(), but it works…