summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-01-27 12:43:53 -0800
committerJeremy Evans <code@jeremyevans.net>2020-01-27 12:48:42 -0800
commitf7d279f3153d27ee5508a214d92e10cfce6597fd (patch)
treea029b8bac9d8470a2a4f7f9286fc0d595587b1cd
parent3df5ded9871eb8a9a39c025b50a3bb6a59e156d2 (diff)
downloadrack-f7d279f3153d27ee5508a214d92e10cfce6597fd.tar.gz
Only use ::Rack::RegexpExtensions on Ruby 2.3
Ruby 2.4+ support Regexp#match? and does not require loading a refinement.
-rw-r--r--lib/rack/deflater.rb2
-rw-r--r--lib/rack/multipart/parser.rb2
-rw-r--r--lib/rack/query_parser.rb2
-rw-r--r--lib/rack/reloader.rb2
-rw-r--r--lib/rack/request.rb2
-rw-r--r--lib/rack/server.rb2
-rw-r--r--lib/rack/static.rb2
-rw-r--r--lib/rack/utils.rb2
8 files changed, 8 insertions, 8 deletions
diff --git a/lib/rack/deflater.rb b/lib/rack/deflater.rb
index 9a30c017..93b2d01e 100644
--- a/lib/rack/deflater.rb
+++ b/lib/rack/deflater.rb
@@ -19,7 +19,7 @@ module Rack
# directive of 'no-transform' is present, or when the response status
# code is one that doesn't allow an entity body.
class Deflater
- using ::Rack::RegexpExtensions
+ using ::Rack::RegexpExtensions if RUBY_VERSION < '2.4'
##
# Creates Rack::Deflater middleware.
diff --git a/lib/rack/multipart/parser.rb b/lib/rack/multipart/parser.rb
index 4c79858e..e9b3c804 100644
--- a/lib/rack/multipart/parser.rb
+++ b/lib/rack/multipart/parser.rb
@@ -9,7 +9,7 @@ module Rack
class MultipartPartLimitError < Errno::EMFILE; end
class Parser
- using ::Rack::RegexpExtensions
+ using ::Rack::RegexpExtensions if RUBY_VERSION < '2.4'
BUFSIZE = 1_048_576
TEXT_PLAIN = "text/plain"
diff --git a/lib/rack/query_parser.rb b/lib/rack/query_parser.rb
index e88b851f..cff8f5b0 100644
--- a/lib/rack/query_parser.rb
+++ b/lib/rack/query_parser.rb
@@ -4,7 +4,7 @@ require_relative 'core_ext/regexp'
module Rack
class QueryParser
- using ::Rack::RegexpExtensions
+ using ::Rack::RegexpExtensions if RUBY_VERSION < '2.4'
DEFAULT_SEP = /[&;] */n
COMMON_SEP = { ";" => /[;] */n, ";," => /[;,] */n, "&" => /[&] */n }
diff --git a/lib/rack/reloader.rb b/lib/rack/reloader.rb
index e23ed1fb..647b4fc1 100644
--- a/lib/rack/reloader.rb
+++ b/lib/rack/reloader.rb
@@ -24,7 +24,7 @@ module Rack
# It is performing a check/reload cycle at the start of every request, but
# also respects a cool down time, during which nothing will be done.
class Reloader
- using ::Rack::RegexpExtensions
+ using ::Rack::RegexpExtensions if RUBY_VERSION < '2.4'
def initialize(app, cooldown = 10, backend = Stat)
@app = app
diff --git a/lib/rack/request.rb b/lib/rack/request.rb
index 22707223..d75a0974 100644
--- a/lib/rack/request.rb
+++ b/lib/rack/request.rb
@@ -15,7 +15,7 @@ module Rack
# req.params["data"]
class Request
- using ::Rack::RegexpExtensions
+ using ::Rack::RegexpExtensions if RUBY_VERSION < '2.4'
class << self
attr_accessor :ip_filter
diff --git a/lib/rack/server.rb b/lib/rack/server.rb
index b09aeb44..306e5746 100644
--- a/lib/rack/server.rb
+++ b/lib/rack/server.rb
@@ -8,7 +8,7 @@ require_relative 'core_ext/regexp'
module Rack
class Server
- using ::Rack::RegexpExtensions
+ using ::Rack::RegexpExtensions if RUBY_VERSION < '2.4'
class Options
def parse!(args)
diff --git a/lib/rack/static.rb b/lib/rack/static.rb
index 2678cb81..0338073f 100644
--- a/lib/rack/static.rb
+++ b/lib/rack/static.rb
@@ -91,7 +91,7 @@ module Rack
# ]
#
class Static
- using ::Rack::RegexpExtensions
+ using ::Rack::RegexpExtensions if RUBY_VERSION < '2.4'
def initialize(app, options = {})
@app = app
diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb
index 8a5bcaca..f60c4919 100644
--- a/lib/rack/utils.rb
+++ b/lib/rack/utils.rb
@@ -15,7 +15,7 @@ module Rack
# applications adopted from all kinds of Ruby libraries.
module Utils
- using ::Rack::RegexpExtensions
+ using ::Rack::RegexpExtensions if RUBY_VERSION < '2.4'
ParameterTypeError = QueryParser::ParameterTypeError
InvalidParameterError = QueryParser::InvalidParameterError