From: Vincent Fourmond Date: 2006-10-29T21:48:20+09:00 Subject: Re: Interesting trival example of why open classes are good? Hello ! > Do you know of a nice little example that doesn't modify a built in > Ruby class? I didn't realize I wasn't specific enough in my request. I can give you that: in a meta system I'm writing, I want to be able to build Qt widgets and to generate command-line parsers from a simple definition. For the sake of simplicity, all this should reside in one class. But I definitely don't want to link to Qt for a command-line-only app. So here is my design: common.rb: class SomeClass def parse_command_line(...) end end qt.rb class SomeClass def create_qt_stuf(...) end end Then, I always have command-line generation available (it's a standard ruby lib), but if I want Qt, I just need to require 'qt.rb' in addition to 'common.rb'. Works great, and rdoc parses everything correclty, which is even greater ! Vince -- Vincent Fourmond, PhD student http://vincent.fourmond.neuf.fr/