P
Pit Capitain
Hi,
what's wrong with this code:
class Regexp
alias :case_eq :===
def ===( other )
case_eq( other )
end
end
p( /x/ === "abxy" ) # => true
p( Regexp.last_match ) # => nil
p( /x/.case_eq( "abxy" ) ) # => true
p( Regexp.last_match ) # => #<MatchData:0x2a67460>
Why is Regexp.last_match not set when calling the redefined method?
This is ruby 1.8.2 (2004-12-25) [i386-mswin32] on Windows 2000.
Regards,
Pit
what's wrong with this code:
class Regexp
alias :case_eq :===
def ===( other )
case_eq( other )
end
end
p( /x/ === "abxy" ) # => true
p( Regexp.last_match ) # => nil
p( /x/.case_eq( "abxy" ) ) # => true
p( Regexp.last_match ) # => #<MatchData:0x2a67460>
Why is Regexp.last_match not set when calling the redefined method?
This is ruby 1.8.2 (2004-12-25) [i386-mswin32] on Windows 2000.
Regards,
Pit