# Class ExistingName

**URL:** <https://www.ruby-forum.com/t/class-existingname/180158>\
**Category:** Ruby\
**Created:** [December 13, 2009, 7:25pm UTC](https://www.ruby-forum.com/t/class-existingname/180158 "2009-12-13T19:25:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 13, 2009, 7:25pm UTC](https://www.ruby-forum.com/t/class-existingname/180158/1 "2009-12-13T19:25:56Z")

</div>

Recently i created a file object.rb

class Object

I forgot that ruby already reserved this name, so I renamed the class.

But I was still curious. Is there a way to use a “class Object”?

I guess there is no easy way, many things would have to be renamed.

Still, I write this here because perhaps one of you has some idea.

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [February 26, 2010, 1:03am UTC](https://www.ruby-forum.com/t/class-existingname/180158/2 "2010-02-26T01:03:12Z")

</div>

> You could place it inside a module:

Thanks that helped.

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 13, 2009, 7:37pm UTC](https://www.ruby-forum.com/t/class-existingname/180158/3 "2009-12-13T19:37:49Z")

</div>

Marc H. wrote:

> Recently i created a file object.rb
> 
> class Object
> 
> I forgot that ruby already reserved this name, so I renamed the class.
> 
> But I was still curious. Is there a way to use a “class Object”?
> 
> I guess there is no easy way, many things would have to be renamed.
> 
> Still, I write this here because perhaps one of you has some idea.

## You could place it inside a module:

module A

class Object

```
def foo
  "foo"
end

```

end

end

## obj = A::Object.new p obj.foo #=\> foo obj = Object.new p obj.foo #=\> NoMethodError

Even if you include it, Object isn’t overwritten:

include A

## obj = Object.new p obj.foo #=\> NoMethodError

Marvin
