From 4d92d2e1aa121cc81ccef0e8a64683bae56cfbb9 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 24 Dec 2013 07:02:37 +0900 Subject: string type check based on #to_str to encourage duck typing; #1616 --- mrblib/string.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrblib/string.rb b/mrblib/string.rb index 53e7c10c0..0d8ed4d01 100644 --- a/mrblib/string.rb +++ b/mrblib/string.rb @@ -137,7 +137,7 @@ class String ## # ISO 15.2.10.5.5 def =~(re) - if re.is_a? String + if re.respond_to? :to_str raise TypeError, "type mismatch: String given" end re =~ self -- cgit v1.2.3