class Rack::PactBroker::ResetThreadData
Public Class Methods
new(app)
click to toggle source
# File lib/rack/pact_broker/reset_thread_data.rb, line 6 def initialize app @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/rack/pact_broker/reset_thread_data.rb, line 10 def call env data = OpenStruct.new Thread.current[:pact_broker_thread_data] ||= data response = @app.call(env) # only delete it if it's the same object that we set if data.equal?(Thread.current[:pact_broker_thread_data]) Thread.current[:pact_broker_thread_data] = nil end response end