diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-12-24 07:02:37 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-12-24 07:02:37 +0900 |
| commit | 4d92d2e1aa121cc81ccef0e8a64683bae56cfbb9 (patch) | |
| tree | 6252cf0bdb6e9a689b32dce2d6bd3fc6028c1c46 | |
| parent | d957a6784195e2a5ef8bac57d05b09baf3baaca1 (diff) | |
| download | mruby-4d92d2e1aa121cc81ccef0e8a64683bae56cfbb9.tar.gz mruby-4d92d2e1aa121cc81ccef0e8a64683bae56cfbb9.zip | |
string type check based on #to_str to encourage duck typing; #1616
| -rw-r--r-- | mrblib/string.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |
