Cannot parse def self.use(...) in Ruby 2.6

This commit is contained in:
Ryuta Kamizono 2019-12-26 18:30:11 +09:00
parent 04f94394b3
commit 3eb1f1dd10

@ -218,16 +218,13 @@ def self.inherited(base) # :nodoc:
super
end
# Pushes the given Rack middleware and its arguments to the bottom of the
# middleware stack.
if RUBY_VERSION >= "2.7"
def self.use(...)
middleware_stack.use(...)
end
else
def self.use(*args, &block)
class << self
# Pushes the given Rack middleware and its arguments to the bottom of the
# middleware stack.
def use(*args, &block)
middleware_stack.use(*args, &block)
end
ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true)
end
# Alias for +middleware_stack+.