Skip to content

Commit 44a8064

Browse files
committed
Use ruby2_keywords for ActionDispatch::MiddlewareStack
1 parent f414dd5 commit 44a8064

File tree

1 file changed

+12
-5
lines changed
  • actionpack/lib/action_dispatch/middleware

1 file changed

+12
-5
lines changed

actionpack/lib/action_dispatch/middleware/stack.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
require "active_support/inflector/methods"
44
require "active_support/dependencies"
55

6+
class Module
7+
unless respond_to?(:ruby2_keywords, true)
8+
def self.ruby2_keywords(*)
9+
end
10+
end
11+
end
12+
613
module ActionDispatch
714
class MiddlewareStack
815
class Middleware
@@ -88,27 +95,27 @@ def [](i)
8895
middlewares[i]
8996
end
9097

91-
def unshift(klass, *args, &block)
98+
ruby2_keywords def unshift(klass, *args, &block)
9299
middlewares.unshift(build_middleware(klass, args, block))
93100
end
94101

95102
def initialize_copy(other)
96103
self.middlewares = other.middlewares.dup
97104
end
98105

99-
def insert(index, klass, *args, &block)
106+
ruby2_keywords def insert(index, klass, *args, &block)
100107
index = assert_index(index, :before)
101108
middlewares.insert(index, build_middleware(klass, args, block))
102109
end
103110

104111
alias_method :insert_before, :insert
105112

106-
def insert_after(index, *args, &block)
113+
ruby2_keywords def insert_after(index, *args, &block)
107114
index = assert_index(index, :after)
108115
insert(index + 1, *args, &block)
109116
end
110117

111-
def swap(target, *args, &block)
118+
ruby2_keywords def swap(target, *args, &block)
112119
index = assert_index(target, :before)
113120
insert(index, *args, &block)
114121
middlewares.delete_at(index + 1)
@@ -118,7 +125,7 @@ def delete(target)
118125
middlewares.delete_if { |m| m.klass == target }
119126
end
120127

121-
def use(klass, *args, &block)
128+
ruby2_keywords def use(klass, *args, &block)
122129
middlewares.push(build_middleware(klass, args, block))
123130
end
124131

0 commit comments

Comments
 (0)