Module: UberS3::Connection

Defined in:
lib/uber-s3/connection.rb,
lib/uber-s3/connection/em_http.rb,
lib/uber-s3/connection/net_http.rb,
lib/uber-s3/connection/em_http_fibered.rb

Defined Under Namespace

Classes: Adapter, EmHttp, EmHttpFibered, NetHttp

Class Method Summary collapse

Class Method Details

.open(s3, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/uber-s3/connection.rb', line 4

def self.open(s3, options={})
  adapter = options.delete(:adapter) || :net_http      
  
  begin
    require "uber-s3/connection/#{adapter}"
    klass = instance_eval(adapter.to_s.split('_').map {|x| x.capitalize}.join(""))
  rescue LoadError
    raise "Cannot load #{adapter} adapter class"
  end
  
  klass.new(s3, options)
end