Module: Faraday::AutoloadHelper

Included in:
Faraday, Adapter, Request, Response
Defined in:
lib/faraday.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) all_loaded_constants



49
50
51
52
# File 'lib/faraday.rb', line 49

def all_loaded_constants
  constants.map { |c| const_get(c) }.
    select { |a| a.respond_to?(:loaded?) && a.loaded? }
end

- (Object) autoload_all(prefix, options)



35
36
37
38
39
# File 'lib/faraday.rb', line 35

def autoload_all(prefix, options)
  options.each do |const_name, path|
    autoload const_name, File.join(prefix, path)
  end
end

- (Object) load_autoloaded_constants

Loads each autoloaded constant. If thread safety is a concern, wrap this in a Mutex.



43
44
45
46
47
# File 'lib/faraday.rb', line 43

def load_autoloaded_constants
  constants.each do |const|
    const_get(const) if autoload?(const)
  end
end

- (Object) lookup_module(key)



30
31
32
33
# File 'lib/faraday.rb', line 30

def lookup_module(key)
  return if !@lookup_module_index
  const_get @lookup_module_index[key] || key
end

- (Object) register_lookup_modules(mods)



26
27
28
# File 'lib/faraday.rb', line 26

def register_lookup_modules(mods)
  (@lookup_module_index ||= {}).update(mods)
end