Hi I would like to initialize the attributes of an instance of a ruby object dinamically via some config file, I can do that pretty fast using the following code:
class ApiTester
def initialize(path= "api_test")
h = eval(File.open("#{path}/config.hash","r").read)
h.each do |k,v|
eval("@#{k}=#{v.class == String ? "\"#{v}\"" : v }" )
end
end
end
How do I give the attribute "@#{k}" the property attr_accessor?