Class: PactBroker::Async::AfterReply

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/async/after_reply.rb

Instance Method Summary collapse

Constructor Details

#initialize(rack_env) ⇒ AfterReply

Returns a new instance of AfterReply.



15
16
17
18
# File 'lib/pact_broker/async/after_reply.rb', line 15

def initialize(rack_env)
  @rack_env = rack_env
  @database_connector = rack_env.fetch("pactbroker.database_connector")
end

Instance Method Details

#execute(&block) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/pact_broker/async/after_reply.rb', line 20

def execute(&block)
  dc = @database_connector
  @rack_env["rack.after_reply"] << lambda {
    dc.call do
      block.call
    end
  }
end