From: Matt Armstrong Date: 2002-01-19T09:16:17+09:00 Subject: Re: A matter of style thomass@deltadata.dk (Thomas) writes: > I'm relatively new to ruby (about a month worth) and I'm wondering if > there, in the ruby community, is some kind of consensus as to whether: > > 1. ...ruby modules should be wrapped in a "namespace" module? There is very little reason not to. Users of your package can include your "namespace" module into their code if they don't want to keep typing YourNamespaceModule::YourClass all the time. This way, they can chose to pollute their namespace with your stuff or not to. Stuff added to your module is automatically part of theirs even after they have done the "include." module TestModule end include TestModule module TestModule def do_something puts "TestModule did something" end class TestClass def do_something puts "TestClass did something" end end end do_something TestClass.new.do_something prints TestModule did something TestClass did something > 2. ...there is a style for breaking a module up into smaller files? Typically the class Foo::Bar::Baz would be in a file foo/bar/baz.rb. This is not enforced by anything, it just makes it easier to find the source and know what to "require". -- matt