From: Nit Khair Date: 2008-10-03T18:40:42+09:00 Subject: Re: Problem extending (adding methods) to class ragav wrote: > You'll see that FORM class has a singleton "new" method which always > returns a FORM object. Class#new is shadowed so you'll never get a > descendant object > > raise MyForm.new.class.inspect #=> Ncurses::Form::FORM > > DelegateClass is a possible solution unless you want to muck with the > C sources. > > --Cheers > --Ragav Ah, i get it. Thanks for the link to DelegateClass - just had a look at it. For the moment, (as mentioned earlier), i created an instance of FORM, and used method_missing to "delegate" calls to it after checking respond_to?, now i can subclass that class as required. Changing the C source will mean others will not be able to use, unless they move to my modified source - don't want that. Thanks for the info. So my question again is: are classes declared within a module typically/always factory classes like this -- i mean with singleton new methods? Perhaps I should look thru the source code of Facets or some other project to jump-start my ruby. Any suggestions? -- Posted via http://www.ruby-forum.com/.