From: Aristarkh A Zagorodnikov Date: 2001-09-05T20:29:30+09:00 Subject: [ruby-talk:20918] Re: Removing singleton methods and instance variables - how ? > -----Original Message----- > From: David Alan Black [mailto:dblack@candle.superlink.net] > Sent: Wednesday, September 05, 2001 3:20 PM > To: ruby-talk ML > Subject: [ruby-talk:20916] Re: Removing singleton methods and > instance variables - how ? > > > Hello -- > > On Wed, 5 Sep 2001, Aristarkh A Zagorodnikov wrote: > > > begin code sample (test.rb) >>>> > > module Test > > def Test.test > > @instance_variable = 'test' > > end > > > > def Test.test_variable > > remove_instance_variable '@instance_variable' > > end > > > > def Test.test_method > > remove_method :test > > end > > end > > Try changing that last one to: > > def Test.test_method > class << self > remove_method :test > end > end > > Also, beware of using 'test' as a name for testing methods in Ruby. I > speak from experience :-) That's just an example - I don't use such names in real life ;) Thanks for help, David! Aristarkh A Zagorodnikov, Lead Programmer, W3D Group http://www.w3d.ru /// xm@w3d.ru /// ICQ UIN 36987938