From 3eb1f1dd105a971d3c83741b02d4da68794b1652 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 26 Dec 2019 18:30:11 +0900 Subject: [PATCH] Cannot parse `def self.use(...)` in Ruby 2.6 --- actionpack/lib/action_controller/metal.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index 85b558f8a2..ad093b73e7 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -218,16 +218,13 @@ module ActionController 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+.