MenTaLguY
9/26/2007 9:35:00 PM
On Thu, 27 Sep 2007 06:26:34 +0900, Larry Fast <lfast@mdsi.ca> wrote:
> I want create objects from a list of class names. What's the syntax for
> this?
You usually _don't_ need to go via class names; for example this works
fine:
class Foo
# ...
end
class Bar
# ...
end
classes = [ Foo, Bar ]
Classes are themselves objects in Ruby, so if you have a class you can
simply call the #new method on it.
instances = classes.map { |c| c.new }
-mental