Remove `String#=~` and `String#match` that requires `Regexp`.

parent d8eff635
......@@ -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
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