K
kenbo
I am coming to Ruby from LISP where I was more competent when it came
to symbol
manipulation
I have spent some time trying to solve this problem
and figure it's my
general lack of deep knowledge ala Ruby that keeps me from seeing an
"easy" solution.
With that said, I apologize if this has been answered and I missed
it.
I have a string in a variable.
foo = "bobo"
I want to use foo to access an array called bobo. I will have bobo
defined already.
Is there a way to do this?
Take foo and use it to access bobo[2], for example.
I thought about turning foo into a symbol, but that wasn't the way.
And, I think there
should be a way to ask Ruby to return an object via its string name,
but I am
missing the way.
any advice would be appreciated.
kenny
to symbol
manipulation
and figure it's my
general lack of deep knowledge ala Ruby that keeps me from seeing an
"easy" solution.
With that said, I apologize if this has been answered and I missed
it.
I have a string in a variable.
foo = "bobo"
I want to use foo to access an array called bobo. I will have bobo
defined already.
Is there a way to do this?
Take foo and use it to access bobo[2], for example.
I thought about turning foo into a symbol, but that wasn't the way.
And, I think there
should be a way to ask Ruby to return an object via its string name,
but I am
missing the way.
any advice would be appreciated.
kenny