2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-28 22:31:50 -04:00
|
|
|
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
|