Dynamic class?

Hi All,
In controller i have one method like
def create_class

   Object.const_get("Array").new

   end

I Ruby forums i cam to know that will create a class called Array.Am i
right??
Now my question is that where is that class when i will find this class
in my project folder i tried but not able to see.

Please help me.

Thanks
Varun

Hi All,
In controller i have one method like
def create_class

   Object.const_get("Array").new

   end

I Ruby forums i cam to know that will create a class called Array.Am i
right??

No, that should be the same as Array.new.

mfg, simon … l

Now my question is that where is that class when i will find this class
in my project folder i tried but not able to see.

What do you mean by project folder? Creating a class will not create a
source file.

mfg, simon … l

On 24.04.2008 17:22, Varun G. wrote:

Hi All,
In controller i have one method like
def create_class

   Object.const_get("Array").new

   end

I Ruby forums i cam to know that will create a class called Array.Am i
right??

No. It will likely create an instance of class Array.

Now my question is that where is that class when i will find this class
in my project folder i tried but not able to see.

You’ll have to look into Ruby’s source code.

Kind regards

robert

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