From: "David A. Black" Date: 2004-06-11T04:31:35+09:00 Subject: Re: library, module, or...? Hi -- On Fri, 11 Jun 2004, tony summerfelt wrote: > i have a class i'm working on: > > class Myclass > def initialize() > end > > def usefulmethod1() > end > > def usefulmethod2() > end > > it's currently over 100 lines and will probably be double that. > > what's the most efficient way of turning that into a library or > module. > > i'm guessing it can't be module because of the initialize method... Sure it can -- you just have to 'include' it in a class (i.e., you can't instantiate the module, but you can still house an initialize method in it for use by classes): module M def initialize puts "hi" end end class C include M end C.new # => hi David -- David A. Black dblack@wobblini.net