Jan-Erik R.
1/11/2009 11:07:00 AM
Cippo Lippo schrieb:
> So: is there a way to do something similar in Ruby? Like using a Module,
> but splitted on separate files, such as :
>
> <in file1.rb>
> Module test
> Class testclass
> end
> end
>
> <in file2.rb>
> Module test
> Class testtwoclass
> end
> end
>
> and then
>
> <in file bootstrapper.rb>
> require 'test'
> ...
> ts = test::testclass.new
> ts2 = test::testtwoclass.new
> ...
this should work perfectly (if you make the Modulename uppercase).
If you don't want to type the "Test::" thingy use "include Test" in
bootstrapper.rb
And if you wan't to just require 'test', the best way is something like
this:
<in test.rb>
Dir["test/*.rb"].each { |file| require file }