I need to create a class but the condition is, I will receive the class name in strings like shown below
["IndividualContact", "Legal"].each do |var|
ind = var.new
end
Now My expectation is, I need to call
IndividualContact.new
and Legal.new
but since var is a string variable, it's calling .new
on a string like given below
"IndividualContact".new
rather than calling
IndividualContact.new
Is there any way can I call as I expected?