Class: AWS::Core::Autoloader
- Inherits:
-
Object
- Object
- AWS::Core::Autoloader
- Defined in:
- lib/aws/core/autoloader.rb
Instance Attribute Summary collapse
-
#autoloads ⇒ Object
readonly
Returns the value of attribute autoloads.
Instance Method Summary collapse
- #autoload(const_name, file_name) ⇒ Object
-
#initialize(klass, prefix = nil) ⇒ Autoloader
constructor
A new instance of Autoloader.
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
#autoloads ⇒ Object (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 |