From: ptkwt@...2.teleport.com (Phil Tomson) Date: 2001-01-27T07:10:04+09:00 Subject: [ruby-talk:9959] Dynamically instantiating a class (with a string) I know I could (and probably should) do this with some kind of a factory pattern... In Perl I can instantiate an object using a string that contains the name of that object, like so: $PLATFROM = "PC"; $myPCTool = "Tool$PLATFORM"->new(blah...); #later: $PLATFORM = "UNIX"; $myUnixTool = "Tool$PLATFORM"->new(blah...); #where I have a class called ToolPC and another called ToolUNIX which #inherit from Tool. I kind of like this capability, is there any way to do something like that in Ruby? Phil