From: "Jan E." Date: 2012-07-01T17:19:58+09:00 Subject: Re: Accessor Methods with a Twist Doug Jolley wrote in post #1066832: > The thing is this: I have this object (i.e., an instance of a class). > This particular instance is used for a multitude of purposes. Among > them is that the instance is needed by several methods contained in a > module. The methods of the module will never require any other > instance. They always require only this particular instance. I guess I > could pass the instance to each of these methods that needs it as an > argument. Since there are so many of the methods of the module that > need the instance, I was hoping that there might be another more > sanitary way of doing it. I don't see why you want to use a module for this. I'd rather use a *class* and pass the object to the initialize method. You can then save it in an instance variable and use it in any method. For example: # create a database connection database = Database.new username: 'root', passwort: '123456' # create an instance of PictureArchive and pass it the database object picture_archive = PictureArchive.new database # the picture archive can now use the database connection my_holiday_pictures = picture_archive.search year: 2011 I think you should only use modules for three things: as a namespace, as a collection of "static" functions (like Math) or as mixin to provide methods to classes (like Enumerable). Your description doesn't fit any of these cases. But again: If you tell use what you actually want to do, we can think about alternative solutions. Or is it a secret? -- Posted via http://www.ruby-forum.com/.