Retreiving column values from a variable column name

I need to retrieve a value from a column which I reference from a
string, I cannot hardcode in the column name.

I would like something like this

text = shape.colour

however I am going to loop through a number of columns and the column
specified after the (.) will be a variable or string.

for p in particulars
  text = shape.p
end

I've seen you can use #{some_string}, what exactly does this do to a
string?

Thanks in advance

···

--
Posted via http://www.ruby-forum.com/.