From: rking@... Date: 2007-06-22T04:30:09+09:00 Subject: Re: undefined method 'a=' when initializing an object On Jun 21, 10:05 am, "Bala Paranj" wrote: > 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. Is this what you're looking for? require 'ostruct' example_data = { 'ba' => 'ilar', 'la' => 'bamba', 'pa' => 'thological', 'ranj' => 'eofmotion(?)', } obj = OpenStruct.new example_data.each do |key, value| obj.send "#{key}=", value end p obj # or just: obj2 = OpenStruct.new example_data p obj2