From e137d1423dd8545e48b40166d8248c846f232e17 Mon Sep 17 00:00:00 2001 From: h2so5 Date: Tue, 24 Dec 2013 00:09:34 +0900 Subject: verify the argument of String#=~ --- mrblib/string.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mrblib/string.rb') diff --git a/mrblib/string.rb b/mrblib/string.rb index 49f87be8b..53e7c10c0 100644 --- a/mrblib/string.rb +++ b/mrblib/string.rb @@ -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 -- cgit v1.2.3