Dynamically Naming a Class Variable with a Param
I swear this is like throwing a football or baseball left handed! I'm stumped on something that I think should be easy - but since I'm still new to Ruby, I'm not sure how to pull it off.
Basically, I want to be able to create a class var based on the value I pass in the constructor. Something like this:
# BEGIN CODE
b = new.Foo("baz")
# END CODE
I was hoping that I would get a new 'Foo' that has a class array called 'baz' - instead I get a syntax error. I just need a short way of constructing empty arrays when I instantiate an object. Otherwise, I guess I could statically name all of the arrays I want, but that doesn't seem really elegant.
And apologies about the code block - I couldn't get the Ruby to format correctly.