string type check based on #to_str to encourage duck typing; #1616

parent d957a678
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment