Sha256: 8c656f5e4edbc4bb7b5bc9d4d4ebfba03baefea7f573414a1e65d5aaecd01714
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require "active_support/inflector/methods" module ActiveSupport module Autoload @@autoloads = {} @@under_path = nil @@at_path = nil @@eager_autoload = false def autoload(const_name, path = @@at_path) full = [self.name, @@under_path, const_name.to_s, path].compact.join("::") location = path || Inflector.underscore(full) if @@eager_autoload @@autoloads[const_name] = location end super const_name, location end def autoload_under(path) @@under_path, old_path = path, @@under_path yield ensure @@under_path = old_path end def autoload_at(path) @@at_path, old_path = path, @@at_path yield ensure @@at_path = old_path end def eager_autoload old_eager, @@eager_autoload = @@eager_autoload, true yield ensure @@eager_autoload = old_eager end def self.eager_autoload! @@autoloads.values.each { |file| require file } end def autoloads @@autoloads end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activesupport-3.0.0.beta | lib/active_support/dependencies/autoload.rb |