From: Stefan Lidman Date: 2004-03-31T17:36:56+09:00 Subject: Re: Silly question... >Is there any way of completely remove a class object's methods instead of >extending the class? > >I'd like to be able to do: > >class A > attr :t > def initialize > @t = 1 > end >end > >a = A.new >puts a.t # => 1 > ># Not extending... redefining here.... >class A > attr :x > def initialize > @x = 3 > end >end > > >a = A.new >puts a.x # => 3 >puts a.t # => error, instead of outputing nil > >I'm finding the above to be a major pain when debugging and prototyping new >code in either irb or an embedded ruby, every time I reload a library. What version are you using I have 1.8.1 and for me that code outputs: 1 ./first.rb:20: warning: method redefined; discarding old initialize 3 nil line 20 is the second "def initialise" line and the warning goes away when I dont run it with "-w". /Stefan