B
Bala Paranj
I have an array of strings that contains the values for attributes of
an object. I have another array that contains the list of attributes
(strings) for an object.
I am creating the class by:
obj = class_name.new
which gives me a valid object for the given object name.
I want to do something like:
obj.attribute1 = value1 and so on by looping through the arrays.
When I run eval("obj.#{a} = #{value}"), I get the undefined method
'a=' error message. Please help. TIA.
an object. I have another array that contains the list of attributes
(strings) for an object.
I am creating the class by:
obj = class_name.new
which gives me a valid object for the given object name.
I want to do something like:
obj.attribute1 = value1 and so on by looping through the arrays.
When I run eval("obj.#{a} = #{value}"), I get the undefined method
'a=' error message. Please help. TIA.