Module: Samuel::Loader

Extended by:
Loader
Included in:
Loader
Defined in:
lib/samuel/loader.rb

Instance Method Summary collapse

Instance Method Details

#apply_driver_patchesObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/samuel/loader.rb', line 5

def apply_driver_patches
  loaded = { :net_http    => defined?(Net::HTTP),
             :http_client => defined?(HTTPClient) }

  Net::HTTP.send(:include, DriverPatches::NetHTTP) if loaded[:net_http]
  HTTPClient.send(:include, DriverPatches::HTTPClient) if loaded[:http_client]

  if loaded.values.none?
    require 'net/http'
    apply_driver_patches
  end
end