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 @@ 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+.