Class: AWS::Core::Autoloader

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/core/autoloader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, prefix = nil) ⇒ Autoloader

Returns a new instance of Autoloader.


46
47
48
49
50
# File 'lib/aws/core/autoloader.rb', line 46

def initialize klass, prefix = nil
  @klass = klass
  @prefix = prefix || klass.name.gsub(/::/, '/').downcase
  @autoloads = {}
end

Instance Attribute Details

#autoloadsObject (readonly)

Returns the value of attribute autoloads


52
53
54
# File 'lib/aws/core/autoloader.rb', line 52

def autoloads
  @autoloads
end

Instance Method Details

#autoload(const_name, file_name) ⇒ Object


54
55
56
57
58
# File 'lib/aws/core/autoloader.rb', line 54

def autoload const_name, file_name
  path = "#{@prefix}/#{file_name}"
  @klass.autoload(const_name, path)
  @autoloads[const_name] = path
end