Dynamic class???

V

Varun Goel

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
 
S

Simon Krahnke

* Varun Goel said:
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
 
S

Simon Krahnke

* Varun Goel said:
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
 
R

Robert Klemme

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top