From: ragav Date: 2008-10-03T18:23:36+09:00 Subject: Re: Problem extending (adding methods) to class On Oct 2, 7:54 pm, Nit Khair wrote: > David A. Black wrote: > > OK, I think what's happening here is that the FORM class is overriding > > new, in such a way that it does not call initialize. So overriding > > initialize doesn't do anything. > > > I don't have a solution worked out but I believe that's the issue. > > Sorry if this sounds silly, i forgot to mention that i *had* attached > the source in my prev mail (f3.rb). Did you run it? > > Thanks a lot for your time and thoughts. > -- > Posted viahttp://www.ruby-forum.com/. David is right. Before the line raise "NULL" if my_form.get_fields().nil? insert raise Ncurses::Form::FORM.singleton_methods(false).join(" ") #=> new 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