verify the argument of String#=~

This commit is contained in:
h2so5
2013-12-24 00:09:34 +09:00
parent 55ef024e83
commit e137d1423d
+3
View File
@@ -137,6 +137,9 @@ class String
##
# ISO 15.2.10.5.5
def =~(re)
if re.is_a? String
raise TypeError, "type mismatch: String given"
end
re =~ self
end