# Dynamic class?

**URL:** <https://www.ruby-forum.com/t/dynamic-class/135755>\
**Category:** Ruby\
**Created:** [April 24, 2008, 5:22pm UTC](https://www.ruby-forum.com/t/dynamic-class/135755 "2008-04-24T17:22:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![varunkumargoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ed8c4c/32.png) [@varunkumargoel](https://www.ruby-forum.com/u/varunkumargoel)\
**Post date:** [April 24, 2008, 5:22pm UTC](https://www.ruby-forum.com/t/dynamic-class/135755/1 "2008-04-24T17:22:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![varunkumargoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ed8c4c/32.png) [@varunkumargoel](https://www.ruby-forum.com/u/varunkumargoel)\
**Post date:** [April 24, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/dynamic-class/135755/2 "2008-04-24T19:36:12Z")

</div>

- Varun G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) (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

---

<div class="post-metadata">

**Author:** ![varunkumargoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ed8c4c/32.png) [@varunkumargoel](https://www.ruby-forum.com/u/varunkumargoel)\
**Post date:** [April 24, 2008, 8:05pm UTC](https://www.ruby-forum.com/t/dynamic-class/135755/3 "2008-04-24T20:05:35Z")

</div>

- Varun G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) (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

---

<div class="post-metadata">

**Author:** ![varunkumargoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ed8c4c/32.png) [@varunkumargoel](https://www.ruby-forum.com/u/varunkumargoel)\
**Post date:** [April 24, 2008, 11:37pm UTC](https://www.ruby-forum.com/t/dynamic-class/135755/4 "2008-04-24T23:37:27Z")

</div>

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
