X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Faviator%2Ffeature%2Ffaraday%2Fautoload.rb;fp=3rdparty%2Fmodules%2Faviator%2Ffeature%2Ffaraday%2Fautoload.rb;h=0000000000000000000000000000000000000000;hb=6e1426dc77fb4e5d51f07c187c6f2219431dc31e;hp=ec413ff8498870995b92a2e18f39d01346477a47;hpb=87423ba664cd5f2bb462ebadd08b1a90d0fe1c8d;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/aviator/feature/faraday/autoload.rb b/3rdparty/modules/aviator/feature/faraday/autoload.rb deleted file mode 100644 index ec413ff84..000000000 --- a/3rdparty/modules/aviator/feature/faraday/autoload.rb +++ /dev/null @@ -1,85 +0,0 @@ -module Faraday - # Internal: Adds the ability for other modules to manage autoloadable - # constants. - module AutoloadHelper - # Internal: Registers the constants to be auto loaded. - # - # prefix - The String require prefix. If the path is inside Faraday, then - # it will be prefixed with the root path of this loaded Faraday - # version. - # options - Hash of Symbol => String library names. - # - # Examples. - # - # Faraday.autoload_all 'faraday/foo', - # :Bar => 'bar' - # - # # requires faraday/foo/bar to load Faraday::Bar. - # Faraday::Bar - # - # - # Returns nothing. - def autoload_all(prefix, options) - if prefix =~ /^faraday(\/|$)/i - prefix = File.join(Faraday.root_path, prefix) - end - options.each do |const_name, path| - autoload const_name, File.join(prefix, path) - end - end - - # Internal: Loads each autoloaded constant. If thread safety is a concern, - # wrap this in a Mutex. - # - # Returns nothing. - def load_autoloaded_constants - constants.each do |const| - const_get(const) if autoload?(const) - end - end - - # Internal: Filters the module's contents with those that have been already - # autoloaded. - # - # Returns an Array of Class/Module objects. - def all_loaded_constants - constants.map { |c| const_get(c) }. - select { |a| a.respond_to?(:loaded?) && a.loaded? } - end - end - - class Adapter - extend AutoloadHelper - autoload_all 'faraday/adapter', - :NetHttp => 'net_http', - :NetHttpPersistent => 'net_http_persistent', - :Typhoeus => 'typhoeus', - :EMSynchrony => 'em_synchrony', - :EMHttp => 'em_http', - :Patron => 'patron', - :Excon => 'excon', - :Test => 'test', - :Rack => 'rack', - :HTTPClient => 'httpclient' - end - - class Request - extend AutoloadHelper - autoload_all 'faraday/request', - :UrlEncoded => 'url_encoded', - :Multipart => 'multipart', - :Retry => 'retry', - :Timeout => 'timeout', - :Authorization => 'authorization', - :BasicAuthentication => 'basic_authentication', - :TokenAuthentication => 'token_authentication', - :Instrumentation => 'instrumentation' - end - - class Response - extend AutoloadHelper - autoload_all 'faraday/response', - :RaiseError => 'raise_error', - :Logger => 'logger' - end -end