From fd37bc53deb2d52fe3134838eab002dfb9ac35ab Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 15 May 2019 09:55:21 +0900 Subject: Remove `String#=~` and `String#match` that requires `Regexp`. --- mrblib/string.rb | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'mrblib') diff --git a/mrblib/string.rb b/mrblib/string.rb index 506f23c83..42d594055 100644 --- a/mrblib/string.rb +++ b/mrblib/string.rb @@ -230,26 +230,16 @@ class String end end - def _regexp(re, mid) - if String === re - if Object.const_defined?(:Regexp) - return Regexp.new(re) - else - raise NotImplementedError, "String##{mid} needs Regexp class" - end - end - re - end - + # those two methods requires Regexp that is optional in mruby ## # ISO 15.2.10.5.3 - def =~(re) - _regexp(re, :=~) =~ self - end + #def =~(re) + # re =~ self + #end ## # ISO 15.2.10.5.27 - def match(re, &block) - _regexp(re, :match).match(self, &block) - end + #def match(re, &block) + # re.match(self, &block) + #end end -- cgit v1.2.3