class Module
Public Instance Methods
autoload(cname, path)
click to toggle source
Module/Class level autoload method.
@param [#to_sym] cname
The constants name.
@param [String] path
File path to require.
@return [String] The $AUTOLOAD table.
# File lib/autoload.rb, line 52 def autoload(cname, path) $AUTOLOAD[[self, cname.to_sym]] << path end
Private Instance Methods
const_missing(name)
click to toggle source
Check the $AUTOLOAD table for a ‘[self, name]` entry. If present, require file and try to get the constant again.
@param [#to_sym] cname
The constants name.
# File lib/autoload.rb, line 67 def const_missing(name) if paths = $AUTOLOAD.delete([self, name]) paths.each do |path| require(path) end const_missing_without_autoload(name) unless const_defined?(name) const_get(name) else const_missing_without_autoload(name) end end
Also aliased as: const_missing_without_autoload