From: Mateusz Tybura Date: 2008-03-20T02:23:58+09:00 Subject: Re: class::new :: --> NUBY ------=_Part_18616_31248484.1205947448610 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Try this code: class KK def new yield if block_given? super end end 2008/3/19, Chinna Karuppan : > > Hi, > I was trying to redefine new in my class..like this.. > > > class KK > alias oldnew new > def new > yield if block_given? > oldnew > end > end > NameError: undefined method `new' for class `KK' > > why is saying no 'new' method....I don't understand. > because I can say KK.new after I define the class which means the method > is there in the class hierarchy and I should be able to override its > implementation.... > > THnks > Chinna > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_18616_31248484.1205947448610--