# "using namespace" equivalent?

**URL:** <https://www.ruby-forum.com/t/using-namespace-equivalent/55312>\
**Category:** Ruby\
**Created:** [March 19, 2006, 3:28pm UTC](https://www.ruby-forum.com/t/using-namespace-equivalent/55312 "2006-03-19T15:28:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![killy-kun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@killy-kun](https://www.ruby-forum.com/u/killy-kun)\
**Post date:** [March 19, 2006, 3:28pm UTC](https://www.ruby-forum.com/t/using-namespace-equivalent/55312/1 "2006-03-19T15:28:53Z")

</div>

I would like to know if there is in ruby an equivalent to the c++  
instruction “using namespace” (in order not to have to prefix things by  
there namespace when needed).

---

<div class="post-metadata">

**Author:** ![killy-kun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@killy-kun](https://www.ruby-forum.com/u/killy-kun)\
**Post date:** [March 19, 2006, 4:59pm UTC](https://www.ruby-forum.com/t/using-namespace-equivalent/55312/2 "2006-03-19T16:59:28Z")

</div>

On Mar 19, 2006, at 8:28 AM, killy-kun wrote:

> I would like to know if there is in ruby an equivalent to the c++  
> instruction “using namespace” (in order not to have to prefix  
> things by there namespace when needed).

Well, if we are talking about a module, you might be able to include it:

> > module Namespace  
> > extend self  
> > def some\_method  
> > puts “Hello!”  
> > end  
> > end  
> > =\> nil
> 
> > Namespace::some\_method  
> > Hello!  
> > =\> nil
> 
> > include Namespace  
> > =\> Object
> 
> > some\_method  
> > Hello!  
> > =\> nil

Hope that helps.

James Edward G. II

---

<div class="post-metadata">

**Author:** ![killy-kun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@killy-kun](https://www.ruby-forum.com/u/killy-kun)\
**Post date:** [March 19, 2006, 7:03pm UTC](https://www.ruby-forum.com/t/using-namespace-equivalent/55312/3 "2006-03-19T19:03:56Z")

</div>

James Edward G. II wrote:

> > > extend self  
> > > some\_method  
> > > Hello!  
> > > =\> nil
> 
> Hope that helps.
> 
> James Edward G. II

Thank you very much !!  
That’s exactely what I was looking for.  
(I was using the “require” instruction, and I thought the “include”  
instruction was quite similar, that is why I didn’t try it…)
