Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove String#match? and Regexp.match? polyfills (#12454)

David Taylor56a573ab4bfc
diff --git a/lib/freedom_patches/match.rb b/lib/freedom_patches/match.rb
deleted file mode 100644
index 4190aec3525..00000000000
--- a/lib/freedom_patches/match.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class String
- # new to Ruby 2.4, fastest way of matching a string to a regex
- unless method_defined? :match?
- def match?(regex)
- !!(self =~ regex)
- end
- end
-end
diff --git a/lib/freedom_patches/regexp.rb b/lib/freedom_patches/regexp.rb
deleted file mode 100644
index 4dd6f7a55d1..00000000000
--- a/lib/freedom_patches/regexp.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-unless ::Regexp.instance_methods.include?(:match?)
- class ::Regexp
- # this is the fast way of checking a regex (zero string allocs) added in Ruby 2.4
- # backfill it for now
- def match?(string)
- !!(string =~ self)
- end
- end
-end