From: Eric Schwartz Date: 2002-11-09T02:53:30+09:00 Subject: Re: understanding modules/classes "Gavin Sinclair" writes: > It is perfectly good style to include a module in a class. That is one of the > primary aims of modules: in this sense, they are called mix-ins. I'm afraid you've confused me further. Let me illustrate. module TestHarness class TestTableModel def initialize(project) @project = project # stuff happens end def MachineList # return a list of machines that have test results for the # current project end #... other methods defined, too. end end This is the Model of an MVC pattern I'm using to display test results from a CGI program. Now, say I'm writing the CGI itself. Inside it, do I say: require 'testharness/testtablemodel' require 'testharness/testtableview include TestHarness model = TestTableModel.new('projname') view = TestTableView.new(model, cgipath) view.display() Or is it better to put the 'include TestHarness' line in testtablemodel.rb itself, so that the client program just has to say: require 'testharness/testtablemodel' require 'testharness/testtableview model = TestTableModel.new('projname') view = TestTableView.new(model, cgipath) view.display() > BTW, since you expressed thanks, can I ask a favour in return? Can you write a > post, with "[FAQ]" in the title, summarising the problem and solution? Then > someone can easily find this information later and add it to the Ruby FAQ. > Thanks! Will do, once I understand it. :) -=Eric -- Come to think of it, there are already a million monkeys on a million typewriters, and Usenet is NOTHING like Shakespeare. -- Blair Houghton