On Mon, 13 Dec 2004 16:12:04 +0900, Nicholas Van Weerdenburg <vanweerd / gmail.com> wrote: > On Mon, 13 Dec 2004 15:20:26 +0900, Miles Keaton <mileskeaton / gmail.com> wrote: > > > > What's the recommended Ruby way to do abstract classes and abstract > > methods? > > > > or extend Object to have a "abstract" keyword that does the boiler > plate for you (the method definitions with the exception). Then your > module looks like this: > > module MyInterface > abstract :method1, :method2, :method3 > end > An example posted by Michael Neumann a few days ago: class Module def abstract(*meths) meths.each do |meth| class_eval "def #{ meth }(*args, &block) raise 'abstract method' end" end end end Then, you have the "abstract" keyword you were mentioning. Sometimes I needed subclasses of a given class to implement their own version of a method and I didn't know how to indicate that beyond documentation. "abstract" comes very handy. Kind Regards, Ed -- Pretty women make us buy beer, ugly women make us drink beer