From: "Mikael Høilund" Date: 2008-08-01T02:27:44+09:00 Subject: Re: super with block On Jul 31, 2008, at 19:10, Lou Zell wrote: > >>> class NString < String >>> def gsub!(*args, &blk) >>> super(*args, &blk) >>> end >>> end > => nil >>> s = NString.new("hi") > => "hi" >>> s.gsub!(/(hi)/){$1} > => "" Looks like this is a problem with using $1 inside the block. Replacing {$1} with {|m| m} makes it work. However, a different issue I now remember running into a long time ago is that `super` is pretty quirky regarding blocks: Calling it as just `super` will pass the block. `super(*args, &block)` will as well, obviously. `super(*args)` will too! The only way to avoid passing the block to super is `super(*args, &nil)`, however ugly that might be. All of this is tested in 1.8.6, and is probably the same in 1.9. -- Mikael Høilund http://hoilund.org/