Class: Brute::Middleware::EventHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/brute/middleware/event_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, handler_class:, **opts) ⇒ EventHandler

Returns a new instance of EventHandler.



9
10
11
12
13
# File 'lib/brute/middleware/event_handler.rb', line 9

def initialize(app, handler_class:, **opts)
  @app = app
  @handler_class = handler_class
  @opts = opts
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
# File 'lib/brute/middleware/event_handler.rb', line 15

def call(env)
  env[:events] = @handler_class.new(env[:events], **@opts)
  @app.call(env)
end