Skip to content

Commit f34d44b

Browse files
committed
Remove warning on Ruby 3.x
1 parent f753248 commit f34d44b

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ A Ruby gem for tokenizing, parsing, and transforming regular expressions.
88
* A scanner/tokenizer based on [Ragel](http://www.colm.net/open-source/ragel/)
99
* A lexer that produces a "stream" of token objects.
1010
* A parser that produces a "tree" of Expression objects (OO API)
11-
* Runs on Ruby 2.x and JRuby runtimes
12-
* Recognizes Ruby 1.8, 1.9, and 2.x regular expressions [See Supported Syntax](#supported-syntax)
11+
* Runs on Ruby 2.x, 3.x and JRuby runtimes
12+
* Recognizes Ruby 1.8, 1.9, 2.x and 3.x regular expressions [See Supported Syntax](#supported-syntax)
1313

1414

1515
_For examples of regexp_parser in use, see [Example Projects](#example-projects)._
@@ -317,7 +317,7 @@ Expression class. See the next section for details._
317317

318318
## Supported Syntax
319319
The three modules support all the regular expression syntax features of Ruby 1.8,
320-
1.9, and 2.x:
320+
1.9, 2.x and 3.x:
321321

322322
_Note that not all of these are available in all versions of Ruby_
323323

lib/regexp_parser/expression.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ def repetitions
8080
return 1..1 unless quantified?
8181
min = quantifier.min
8282
max = quantifier.max < 0 ? Float::INFINITY : quantifier.max
83-
# fix Range#minmax - https://bugs.ruby-lang.org/issues/15807
84-
(min..max).tap do |r|
85-
r.define_singleton_method(:minmax) { [min, max] } unless RUBY_VERSION.to_f > 2.6
83+
range = min..max
84+
# fix Range#minmax on old Rubies - https://bugs.ruby-lang.org/issues/15807
85+
if RUBY_VERSION.to_f < 2.7
86+
range.define_singleton_method(:minmax) { [min, max] }
8687
end
88+
range
8789
end
8890

8991
def greedy?

lib/regexp_parser/syntax/version_lookup.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def comparable_version(name)
7474
end
7575

7676
def warn_if_future_version(const_name)
77-
return if comparable_version(const_name) < comparable_version('3.0.0')
77+
return if comparable_version(const_name) < comparable_version('4.0.0')
7878

79-
warn('This library has only been tested up to Ruby 2.x, '\
79+
warn('This library has only been tested up to Ruby 3.x, '\
8080
"but you are running with #{const_get(const_name).inspect}")
8181
end
8282
end

0 commit comments

Comments
 (0)