From: "Jesús Gabriel y Galán" Date: 2008-08-01T14:54:13+09:00 Subject: Re: super with block On Thu, Jul 31, 2008 at 7:10 PM, Lou Zell wrote: >> Hi, >> >> This worked for me: >> >> irb(main):023:0> class NString < String >> irb(main):024:1> def gsub!(*args, &blk) >> irb(main):025:2> super(*args, &blk) >> irb(main):026:2> end >> irb(main):027:1> end >> => nil >> irb(main):028:0> s = NString.new("hi") >> => "hi" >> irb(main):029:0> s.gsub!(/(hi)/){$1} >> => "hi" >> >> Hope this helps, >> >> Jesus. > > > Hi Jesus, thank you for your response. Unfortunately, I could not > replicate your results: Sorry, it seems that my $1 was set by previous tests in IRB :-( The others are right and the discussion has been interesting. It also shows you have to be careful with tests in IRB... Jesus.