From 575dbeeefcaafeb566afc07cdd8b55603b698d9f Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 21 Jul 2016 23:41:03 +0200 Subject: define Range#match? if Ruby < 2.4 See the rationale in the documentation included in this patch. We are going to gradually introduce this predicate in the code base. --- activesupport/lib/active_support/core_ext/regexp.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/regexp.rb b/activesupport/lib/active_support/core_ext/regexp.rb index 784145f5fb..d9cff52050 100644 --- a/activesupport/lib/active_support/core_ext/regexp.rb +++ b/activesupport/lib/active_support/core_ext/regexp.rb @@ -2,4 +2,8 @@ class Regexp #:nodoc: def multiline? options & MULTILINE == MULTILINE end + + def match?(string, pos=0) + !! match(string, pos) + end unless //.respond_to?(:match?) end -- cgit v1.2.3