Class: RackAfterReply::Adapter::Unicorn

Inherits:
Base
  • Object
show all
Defined in:
lib/rack_after_reply/adapter/unicorn.rb

Instance Method Summary collapse

Methods inherited from Base

apply, instance

Instance Method Details

#applyObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rack_after_reply/adapter/unicorn.rb', line 4

def apply
  ::Unicorn::HttpServer.module_eval do
    include RackAfterReply::RequestHandler

    def process_client_with_rack_after_reply(client)
      # We can't install the AppProxy in #initialize, because
      # the HttpServer is already instantiated by the time we
      # typically run. Wrap it here exactly once.
      self.app = AppProxy.new(self, app) unless @rack_after_reply_wrapped
      @rack_after_reply_wrapped = true

      process_client_without_rack_after_reply(client)
      fire_rack_after_reply
    end
    RackAfterReply.freedom_patch(self, :process_client)
  end
end