aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/vendor/backports/string.rb
blob: 6299a3fb48432d850ecc7a291ac4a504332266c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# Taken from https://github.com/marcandre/backports/blob/v3.8.0/lib/backports/2.4.0/string/match.rb
unless String.method_defined? :match?
  class String
    def match?(*args)
      # Fiber to avoid setting $~
      f = Fiber.new do
        !match(*args).nil?
      end
      f.resume
    end
  end
end