--nextPart2117864.VEe4HqzxKp
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit

Hello,

I've run into a strange issue with ruby 1.9.1, the following code

class TestBase
  @regex = []
  class << self
    def run_tests
      @regex.each { |regexp, replacer|
        puts "asdf".gsub(regexp, &replacer)
      }
    end
  end
end

class RegexpTest < TestBase
  @regex = [
    [
      /a/, Proc.new { |str|
        puts "Matched string: #{str}"
        puts "last match: #{$~.inspect}"
        str
      }
    ]
  ]
end

RegexpTest.run_tests

prints:

Matched string: a
last match: nil
asdf

Could someone explain why last match is not set ?
Thanks,

-- mb

--nextPart2117864.VEe4HqzxKp
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAABAgAGBQJKv0+8AAoJECwF64gHdCswnL4QAM74gxB9cu4pbJVDNwpAgqG6
I26hqzCMQLkKkQEbE832RzkBjAZVzB974meK7trCPILXoBARJpbikVOl9f9njhdn
dfOtQ4JrLcmU3lhy5Y/kYDkmxpAhl8ELw02zdaN+WWCPH0ApP9Foxf2UI2ykPvFJ
OcCAmgWBkJBeQEAQ74ZHA4aXqN5T/0ni4ASHReJsl5Q2ax27pSFfdvdRkcHRuX8R
IECLEzIbg1qCM1JhkT8+VICsjtjZXNmRhtMD3GkDSJRNRnxi3C5noc7CR7hd9n2A
5ULYtW3OzQtlwjCSV9fTctRLqh3O71/hQvezUzlj+A53FQ0botEp4PfVrpG0hjEj
prhUifXMXSOjVP6GJsLS2qH//JE89MIjkKT/pO/yct3yc5+pInoJ7rYyrWAArOsz
Yyn0xtz7RsoWtB6y6qHRna0Ott3NFMQXHe4KJg9enoLt+j8BM8OX7QT7gjN4Xfnk
x+2RdJQgHAC86Bp12HlTgW1h4eF1kugbN9589nmMirS5ZR+SwFFuJwzEbODgfxEK
QoN2T9xstmPiAT/seN2YSrlndQHXETxeXjpxV1pbzfcnVoYE2p6L5ACLN6yUqyiP
q+wsCwiLAxl3+fzMX0VpuC0SLyPPtA4QKpHuwkv+BbOJBctoMbBhyj2iqyxBZVju
80X7Ay2dhe5b169j/CMz
=iSx3
-----END PGP SIGNATURE-----

--nextPart2117864.VEe4HqzxKp--