module Gateway::Connection::ThreadLocal

Protected Instance Methods

purge_current_connection_from_thread_local!() click to toggle source
# File lib/gateway/connection/thread_local.rb, line 11
def purge_current_connection_from_thread_local!
  Thread.current[thread_local_connection_name] = nil
end
thread_local_connection() click to toggle source
# File lib/gateway/connection/thread_local.rb, line 19
def thread_local_connection
  Thread.current[thread_local_connection_name] ||= connect
end
thread_local_connection_name() click to toggle source
# File lib/gateway/connection/thread_local.rb, line 15
def thread_local_connection_name
  "#{self.class.name}:#{self.name}"
end
with_thread_local(&block) click to toggle source
# File lib/gateway/connection/thread_local.rb, line 6
def with_thread_local(&block)
  conn = thread_local_connection
  block.call conn
end