2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00
discourse/lib/freedom_patches/regexp.rb

10 lines
246 B
Ruby
Raw Normal View History

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