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

Discussion in 'Ruby' started by femto femto, Aug 17, 2006.

  1. femto femto

    femto femto Guest

    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.
    femto femto, Aug 17, 2006
    #1
    1. Advertising

  2. On 17/08/06, femto femto <> 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
    Farrel Lifson, Aug 17, 2006
    #2
    1. Advertising

  3. femto femto

    femto femto Guest

    got it,Thanks.

    On 8/17/06, Farrel Lifson <> wrote:
    > On 17/08/06, femto femto <> 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
    >
    >



    --
    Best Regards
    femto http://femto.blogdriver.com
    femto femto, Aug 17, 2006
    #3
  4. femto femto

    Trans Guest

    Trans, Aug 17, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miguel De Anda

    ClassLoader or Class.newInstance

    Miguel De Anda, Jul 14, 2003, in forum: Java
    Replies:
    1
    Views:
    823
    John C. Bollinger
    Jul 15, 2003
  2. cyril
    Replies:
    2
    Views:
    3,835
    cyril
    Aug 25, 2004
  3. Alex Hunsley
    Replies:
    14
    Views:
    574
    Heiko Wundram
    Jul 19, 2004
  4. jean-francois
    Replies:
    2
    Views:
    595
  5. Abu Yahya
    Replies:
    43
    Views:
    3,022
    Michael Wojcik
    Jun 23, 2011
Loading...

Share This Page