Skip to content

Commit 5cd776a

Browse files
committed
Add ability to use multiple instances of middleware
1 parent 6731e23 commit 5cd776a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/rack/attack.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,15 @@ def clear!
8484

8585
attr_reader :configuration
8686

87-
def initialize(app)
87+
def initialize(app, &block)
8888
@app = app
89-
@configuration = self.class.configuration
89+
@configuration =
90+
if block_given?
91+
configuration = Configuration.new
92+
configuration.instance_exec(&block)
93+
else
94+
self.class.configuration
95+
end
9096
end
9197

9298
def call(env)

0 commit comments

Comments
 (0)