# Help with object scope

**URL:** <https://www.ruby-forum.com/t/help-with-object-scope/74129>\
**Category:** Ruby\
**Created:** [December 21, 2005, 6:13am UTC](https://www.ruby-forum.com/t/help-with-object-scope/74129 "2005-12-21T06:13:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lstrecv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e68b1a/32.png) [@lstrecv](https://www.ruby-forum.com/u/lstrecv)\
**Post date:** [December 21, 2005, 6:13am UTC](https://www.ruby-forum.com/t/help-with-object-scope/74129/1 "2005-12-21T06:13:41Z")

</div>

I’m having a really tough time with Ruby’s scope (modules, include,  
etc.).

I had a file, in short:

module M  
class C  
end  
end

# Unit Tests

include M  
class TestM  
def setup; C.blah; end  
end

Works great.

_However_, if I wrap the unit tests in their own module, then ruby can  
no longer find class C. Why? Didn’t I include module M? I’m really  
confused here.

If you want the full source, I can post it.

Thanks  
PS If you could also direct me to a good link explaining this stuff, I’d  
really appreciate it. I have to say that I don’t know Ruby’s exact  
definition of a module. I know it is a namespace, but it seems to be  
more than that (as evidenced by the fact that it has methods, and can be  
mixedin, and the like).
