[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Dynamic class???

Varun Goel

4/24/2008 3:22:00 PM

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
--
Posted via http://www.ruby-....

3 Answers

Simon Krahnke

4/24/2008 5:27:00 PM

0

* Varun Goel <varun.rajeshkumar@gmail.com> (17:22) schrieb:

> 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

Simon Krahnke

4/24/2008 5:39:00 PM

0

* Varun Goel <varun.rajeshkumar@gmail.com> (17:22) schrieb:

> 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

Robert Klemme

4/24/2008 9:31:00 PM

0

On 24.04.2008 17:22, Varun Goel 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