File: loader.rb

package info (click to toggle)
ruby-samuel 0.3.3-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, trixie
  • size: 172 kB
  • sloc: ruby: 735; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 460 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Samuel
  module Loader
    extend self

    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
  end
end