diff options
author | Xavier Noria <fxn@hashref.com> | 2016-07-21 23:41:03 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-07-22 00:15:52 +0200 |
commit | 575dbeeefcaafeb566afc07cdd8b55603b698d9f (patch) | |
tree | 8371e5e85e11f242c0fbb6fb42fb63b5edac6fa4 /activesupport/lib | |
parent | d4ea18a8cb84601509ee4c6dc691b212af8c2c36 (diff) | |
download | rails-575dbeeefcaafeb566afc07cdd8b55603b698d9f.tar.gz rails-575dbeeefcaafeb566afc07cdd8b55603b698d9f.tar.bz2 rails-575dbeeefcaafeb566afc07cdd8b55603b698d9f.zip |
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.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/regexp.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 |