Something like Class.forName(''...").newInstance in Java?

hello all,
I’m looking for something like Class.forName(’’…").newInstance in
Java?,
I mean, where the className is passed in as a String,
do ruby have similiar construct like that?
Thank you very much.

On 17/08/06, femto femto [email protected] wrote:

hello all,
I’m looking for something like Class.forName(’’…").newInstance in Java?,
I mean, where the className is passed in as a String,
do ruby have similiar construct like that?
Thank you very much.

Object.const_get("…").new

Farrel

got it,Thanks.

Facets’ constant() method is sometimes easier.

http://facets.rubyforge.org/api/core/classes/Kernel.html#M000437

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs