From: Damjan Rems Date: 2008-03-03T19:20:46+09:00 Subject: Re: Understanding ruby classes Thanks to all. So far I was able to reproduce this scenario which works. def myPrint001(opts) formater = 'MyPrint2' + opts[:format] o = Class.new(Object.const_get(formater)) do def printHDR image 'image.jpg' 20, 1 print 'some header text' 1,5 ... end def doJob print 'some text' 1,5 end end.new o.doJob end But it's kinda ugly. I do prefare Thomas aproach with MyPrintFactory if there was a way to avoid to preceide every keyword with 'printer.' statement. printer = MyPrintFactory.getPrinter :format => 'html' printer.doJob In my last OO language I was using (Alaska XBase++ if known to anybody ;-) I actualy had precompile directive which replaced print with printer.print before compilation. More ideas anybody. by TheR -- Posted via http://www.ruby-forum.com/.