From: "Florian Groß" Date: 2005-12-22T00:23:49+09:00 Subject: Re: Help with object scope List Recv wrote: > So, > 1) How do I call C from class TestM without explicitly using its > namespace (M:C)? Is there no way? I don't want to modify Kernel or > anything, just have class C available. Try this instead: > class TestM > include M > def setup; C.blah; end > end A module is a set of instance methods and constants. It can either be used as a namespace or mix-in functionality. (For the latter you are collecting similar methods / constants together in one Module so you can add them to your own classes or objects easily.) mod_or_cls.include(mod) will add all constants and instance methods of mod to mod_or_cls. obj.extend(mod) will add all constants and instance methods of mod to an object itself. Here's a sample: module HalfString def half() self[0, length / 2] end end str = "foobar" str.half() # raises NoMethodError str.extend(HalfString) str.half() # => "foo" "hello".half() # raises NoMethodError You can't ever include classes. You can only inherit from them. -- http://flgr.0x42.net/