interloper 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/interloper/version.rb +1 -1
- data/lib/interloper.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 064c0ba76ebb460dc19eca46ac6df915c73043c0
|
4
|
+
data.tar.gz: 7a055d93858d21e1b21a99284b8b87e7f7f8a258
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1bf227a3d8b5296ee34f1e9a2b69438e27b534b21564350ff7086a29067d0b38d21535f3f54cb67a10c1d9242e1dacbecdb97329d17bc084cea787429a3e2d0
|
7
|
+
data.tar.gz: b44c9dd4a5c19d9a84a8cc7240cd332ce26cec082577c0a001cc0b2b9fc03f1efdc080e22316435e985b7546c5eff7463bc5b056171b415152accf7ed4db6b6c
|
data/lib/interloper/version.rb
CHANGED
data/lib/interloper.rb
CHANGED
@@ -26,11 +26,11 @@ module Interloper
|
|
26
26
|
# @return Module the Interloper module that was prepended to the including
|
27
27
|
# class.
|
28
28
|
def interloper_module
|
29
|
-
|
29
|
+
@interloper_module ||= begin
|
30
30
|
const_set(interloper_const_name, generate_interloper_module)
|
31
31
|
prepend const_get(interloper_const_name)
|
32
|
+
const_get(interloper_const_name)
|
32
33
|
end
|
33
|
-
const_get(interloper_const_name)
|
34
34
|
end
|
35
35
|
|
36
36
|
# @return Boolean True if the interloper module has already been prepnded;]
|
@@ -139,21 +139,21 @@ module Interloper
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def inherit_callbacks_before(*method_names)
|
142
|
-
|
142
|
+
ancestor_callbacks(:before, *method_names).each do |callback|
|
143
143
|
before(*method_names, &callback)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
def inherit_callbacks_after(*method_names)
|
148
|
-
|
148
|
+
ancestor_callbacks(:after, *method_names).each do |callback|
|
149
149
|
after(*method_names, &callback)
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
-
def
|
153
|
+
def ancestor_callbacks(hook, *method_names)
|
154
154
|
method_names.map do |method_name|
|
155
155
|
ancestor_interloper_module.callbacks[hook][method_name]
|
156
|
-
end.flatten
|
156
|
+
end.flatten.compact
|
157
157
|
end
|
158
158
|
|
159
159
|
# @return [Module] The nearest ancstors tha is an interloper module.
|