monkey-lib 0.3.5.3 → 0.3.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/monkey/autoloader.rb +18 -0
- metadata +1 -1
data/lib/monkey/autoloader.rb
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
require "monkey"
|
2
2
|
|
3
|
+
Module.class_eval do
|
4
|
+
alias const_missing_without_detection const_missing
|
5
|
+
|
6
|
+
def const_missing(const_name)
|
7
|
+
if parent.autoloader? and not is_a? Monkey::Autoloader
|
8
|
+
extend Monkey::Autoloader
|
9
|
+
const_missing const_name
|
10
|
+
else
|
11
|
+
const_missing_without_detection const_name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def autoloader?
|
16
|
+
is_a? Monkey::Autoloader or (parent != self and parent.autoloader?)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
3
21
|
module Monkey
|
4
22
|
module Autoloader
|
5
23
|
def const_missing(const_name)
|