Class: Aws::EagerLoader Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/eager_loader.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEagerLoader

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of EagerLoader



7
8
9
# File 'lib/aws-sdk-core/eager_loader.rb', line 7

def initialize
  @loaded = Set.new
end

Instance Attribute Details

#loadedSet<Module> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/aws-sdk-core/eager_loader.rb', line 12

def loaded
  @loaded
end

Instance Method Details

#load(klass_or_module) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/aws-sdk-core/eager_loader.rb', line 16

def load(klass_or_module)
  @loaded << klass_or_module
  klass_or_module.constants.each do |const_name|
    path = klass_or_module.autoload?(const_name)
    begin
      require(path) if path
      const = klass_or_module.const_get(const_name)
      self.load(const) if Module === const && !@loaded.include?(const)
    rescue LoadError
    end
  end
  self
end