Forum: Ruby Help with object scope

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ccfe7d097475a32dc3ff78d6fc42c852?d=identicon&s=25 List Recv (lstrecv)
on 2005-12-21 06:13
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).
This topic is locked and can not be replied to.