module Faraday::AutoloadHelper

def all_loaded_constants

Returns an Array of Class/Module objects.

autoloaded.
Internal: Filters the module's contents with those that have been already
def all_loaded_constants
  constants.map { |c| const_get(c) }.
    select { |a| a.respond_to?(:loaded?) && a.loaded? }
end

def autoload_all(prefix, options)

Returns nothing.


Faraday::Bar
# requires faraday/foo/bar to load Faraday::Bar.

:Bar => 'bar'
Faraday.autoload_all 'faraday/foo',

Examples.

options - Hash of Symbol => String library names.
version.
it will be prefixed with the root path of this loaded Faraday
prefix - The String require prefix. If the path is inside Faraday, then

Internal: Registers the constants to be auto loaded.
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

def load_autoloaded_constants

Returns nothing.

wrap this in a Mutex.
Internal: Loads each autoloaded constant. If thread safety is a concern,
def load_autoloaded_constants
  constants.each do |const|
    const_get(const) if autoload?(const)
  end
end