Sha256: 9b2007709fb0df83e48f6545170bd30c3761657e699a328f131c90c2c1871b5f
Contents?: true
Size: 676 Bytes
Versions: 20
Compression:
Stored size: 676 Bytes
Contents
module ActiveRestClient class ConnectionManager def self.reset! Thread.current[:_connections]={} end def self.get_connection(base_url) raise Exception.new("Nil base URL passed to ConnectionManager.get_connection") if base_url.nil? Thread.current[:_connections] ||= {} Thread.current[:_connections][base_url] ||= Connection.new(base_url) Thread.current[:_connections][base_url] end def self.find_connection_for_url(url) Thread.current[:_connections] ||= {} found = Thread.current[:_connections].keys.detect {|key| url[0,key.length] == key} Thread.current[:_connections][found] if found end end end
Version data entries
20 entries across 20 versions & 1 rubygems