Is there a way (metaprogramming?) To read / write an instance variable when we just know its string name?
For example, I have an @my_var instance variable used in a class method. During the process, I can create the string "my_var" that tells me to change the @my_var instance variable.
Of course, I could use an if statement, but I want it to be more dynamic, since I will have potentially many different instance variables in my method.
I was thinking about something with "my_var" .classify and something else ...
Does anyone have a key?
thanks for the help
Douglas
source share