# Need help understanding namespace rules-modules and classes

**URL:** <https://www.ruby-forum.com/t/need-help-understanding-namespace-rules-modules-and-classes/94876>\
**Category:** Ruby\
**Created:** [May 17, 2006, 12:18am UTC](https://www.ruby-forum.com/t/need-help-understanding-namespace-rules-modules-and-classes/94876 "2006-05-17T00:18:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [May 17, 2006, 12:18am UTC](https://www.ruby-forum.com/t/need-help-understanding-namespace-rules-modules-and-classes/94876/1 "2006-05-17T00:18:45Z")

</div>

I’m having a namespace collision and I think I need some basic  
understanding of how Ruby is managing namespaces. I am 99% sure I know  
which namespaces are colliding, but I’m not completely clear on how to  
resolve it.

I have Module A (rubyful\_soup.rb) which defines class Tag. It appears  
that this Tag class is not defined inside of a module.

I have Module B (node.rb) which defines class Tag. It appears that this  
Tag class is defined inside of a module called HTML.

However, I seem to be unable to avoid a “wrong number of arguments”  
error when an attempt is made to instantiate Tag in node.rb, and I am  
pretty sure that Tag from rubyful\_soup.rb is interfering.

Here are my questions:

1. If I define a class _inside_ of a module, and then address that class  
by module\_name::class\_name, should that ensure that I will get that  
class? Is the namespace actually defined by the module names or not?

2. Assuming that module::class is the correct way to address the class,  
then _within_ a module, would I need to address my classes using  
module::class consistently or can I just use the class name in the  
module?

Can someone give me an example of how I could address having two  
different classes of the same name in two different modules?

I’m just not understanding what the equivalent of the Java package  
structure is in Ruby.

Thanks,  
Wes
