Class: ActionDispatch::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/action_dispatch/middleware/executor.rb

Direct Known Subclasses

Reloader

Instance Method Summary collapse

Constructor Details

#initialize(app, executor) ⇒ Executor

Returns a new instance of Executor.



5
6
7
# File 'lib/action_dispatch/middleware/executor.rb', line 5

def initialize(app, executor)
  @app, @executor = app, executor
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/action_dispatch/middleware/executor.rb', line 9

def call(env)
  state = @executor.run!
  begin
    response = @app.call(env)
    returned = response << ::Rack::BodyProxy.new(response.pop) { state.complete! }
  ensure
    state.complete! unless returned
  end
end