Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/class_loader.rb,
lib/class_loader/support.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.namespace_for(class_name) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/class_loader/support.rb', line 17 def self.namespace_for class_name @namespace_for_cache ||= {} unless @namespace_for_cache.include? class_name list = class_name.split("::") @namespace_for_cache[class_name] = if list.size > 1 list.pop eval list.join("::"), TOPLEVEL_BINDING, __FILE__, __LINE__ else nil end end @namespace_for_cache[class_name] end |
Instance Method Details
#const_missing(const) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/class_loader.rb', line 5 def const_missing const ClassLoader.load(self, const) || begin const_missing_without_cl(const) rescue => e # Removing ClassLoader from backtrace. raise e.class, e., ClassLoader.filter_backtrace(e.backtrace) end end |
#const_missing_without_cl ⇒ Object
4 |
# File 'lib/class_loader.rb', line 4 alias_method :const_missing_without_cl, :const_missing |