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

Version Path
active_rest_client-1.0.9 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.8 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.7 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.6 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.5 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.4 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.3 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.2 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.1 lib/active_rest_client/connection_manager.rb
active_rest_client-1.0.0 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.75 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.73 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.72 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.71 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.70 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.69 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.68 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.67 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.66 lib/active_rest_client/connection_manager.rb
active_rest_client-0.9.65 lib/active_rest_client/connection_manager.rb