module-cluster 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -0
- data/README.rdoc +21 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClass.rb +83 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb +70 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModule.rb +79 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb +22 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +11 -3
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +10 -2
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +15 -3
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +10 -2
- data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +13 -2
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +34 -34
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +3 -3
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +43 -43
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +34 -34
- data/lib/module-cluster/ModuleCluster/Define/Status.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Define.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Suspend/Hooks.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Suspend.rb +1 -1
- data/lib/module-cluster/ModuleCluster.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +3 -3
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +85 -32
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/Subclass.rb +6 -3
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +5 -5
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +9 -9
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Inherited.rb +3 -3
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +5 -5
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +9 -9
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +1 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +13 -13
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +10 -10
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +13 -13
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +10 -10
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Status.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Suspend.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade/Subclass.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +1 -1
- data/lib/module-cluster.rb +14 -2
- data/spec/ModuleCluster/Define/Block/CascadingClassOrModule_spec.rb +285 -0
- data/spec/ModuleCluster/Define/Block/CascadingClass_spec.rb +241 -0
- data/spec/ModuleCluster/Define/Block/CascadingModuleOrSubclass_spec.rb +56 -0
- data/spec/ModuleCluster/Define/Block/CascadingModule_spec.rb +278 -0
- data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +2 -3
- data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +2 -2
- data/spec/ModuleCluster/Define/Block/Class_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/Instance_spec.rb +5 -5
- data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +1 -1
- data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +2 -4
- data/spec/ModuleCluster/Define/Block/Module_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +8 -8
- data/spec/ModuleCluster/Define/Block_spec.rb +9 -9
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +227 -227
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +197 -197
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +228 -228
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +232 -232
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +224 -224
- data/spec/ModuleCluster/Define/Cluster_spec.rb +221 -221
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +29 -29
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +227 -227
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +227 -227
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +197 -197
- data/spec/ModuleCluster/Suspend/Hooks_spec.rb +120 -120
- data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +120 -120
- data/spec/ModuleCluster_spec.rb +2 -2
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +192 -192
- data/spec/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy_spec.rb +129 -129
- data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +17 -17
- metadata +9 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
module ModuleCluster::ClusterStack::PrependsExtends
|
2
|
+
module ::ModuleCluster::ClusterStack::PrependsExtends
|
3
3
|
|
4
4
|
#############################
|
5
5
|
# prepend_extend_hooks #
|
@@ -14,7 +14,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
14
14
|
##############################
|
15
15
|
|
16
16
|
def extend_prepends_includes( module_instance, method, includes, runtime_includes_block )
|
17
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include, includes, runtime_includes_block )
|
17
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include, includes, runtime_includes_block )
|
18
18
|
prepend_extend_hooks.push( new_set )
|
19
19
|
return new_set
|
20
20
|
end
|
@@ -24,7 +24,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
24
24
|
#############################
|
25
25
|
|
26
26
|
def extend_prepends_extends( module_instance, method, extends, runtime_extends_block )
|
27
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :extend, extends, runtime_extends_block )
|
27
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :extend, extends, runtime_extends_block )
|
28
28
|
prepend_extend_hooks.push( new_set )
|
29
29
|
return new_set
|
30
30
|
end
|
@@ -34,7 +34,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
34
34
|
##########################################
|
35
35
|
|
36
36
|
def extend_prepends_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
37
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
37
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
38
38
|
prepend_extend_hooks.push( new_set )
|
39
39
|
return new_set
|
40
40
|
end
|
@@ -44,7 +44,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
44
44
|
#####################################
|
45
45
|
|
46
46
|
def module_extend_prepends_includes( module_instance, method, includes, runtime_includes_block )
|
47
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include, includes, runtime_includes_block )
|
47
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include, includes, runtime_includes_block )
|
48
48
|
prepend_extend_hooks.push( new_set )
|
49
49
|
return new_set
|
50
50
|
end
|
@@ -54,7 +54,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
54
54
|
####################################
|
55
55
|
|
56
56
|
def module_extend_prepends_extends( module_instance, method, extends, runtime_extends_block )
|
57
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :extend, extends, runtime_extends_block )
|
57
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :extend, extends, runtime_extends_block )
|
58
58
|
prepend_extend_hooks.push( new_set )
|
59
59
|
return new_set
|
60
60
|
end
|
@@ -64,7 +64,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
64
64
|
#################################################
|
65
65
|
|
66
66
|
def module_extend_prepends_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
67
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
67
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
68
68
|
prepend_extend_hooks.push( new_set )
|
69
69
|
return new_set
|
70
70
|
end
|
@@ -74,7 +74,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
74
74
|
####################################
|
75
75
|
|
76
76
|
def class_extend_prepends_includes( module_instance, method, includes, runtime_includes_block )
|
77
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include, includes, runtime_includes_block )
|
77
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include, includes, runtime_includes_block )
|
78
78
|
prepend_extend_hooks.push( new_set )
|
79
79
|
return new_set
|
80
80
|
end
|
@@ -84,7 +84,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
84
84
|
###################################
|
85
85
|
|
86
86
|
def class_extend_prepends_extends( module_instance, method, extends, runtime_extends_block )
|
87
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :extend, extends, runtime_extends_block )
|
87
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :extend, extends, runtime_extends_block )
|
88
88
|
prepend_extend_hooks.push( new_set )
|
89
89
|
return new_set
|
90
90
|
end
|
@@ -94,7 +94,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
94
94
|
################################################
|
95
95
|
|
96
96
|
def class_extend_prepends_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
97
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
97
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
98
98
|
prepend_extend_hooks.push( new_set )
|
99
99
|
return new_set
|
100
100
|
end
|
@@ -104,7 +104,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
104
104
|
#######################################
|
105
105
|
|
106
106
|
def instance_extend_prepends_includes( module_instance, method, includes, runtime_includes_block )
|
107
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :include, includes, runtime_includes_block )
|
107
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :include, includes, runtime_includes_block )
|
108
108
|
prepend_extend_hooks.push( new_set )
|
109
109
|
return new_set
|
110
110
|
end
|
@@ -114,7 +114,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
114
114
|
######################################
|
115
115
|
|
116
116
|
def instance_extend_prepends_extends( module_instance, method, extends, runtime_extends_block )
|
117
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :extend, extends, runtime_extends_block )
|
117
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :extend, extends, runtime_extends_block )
|
118
118
|
prepend_extend_hooks.push( new_set )
|
119
119
|
return new_set
|
120
120
|
end
|
@@ -124,7 +124,7 @@ module ModuleCluster::ClusterStack::PrependsExtends
|
|
124
124
|
###################################################
|
125
125
|
|
126
126
|
def instance_extend_prepends_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
127
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
127
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
128
128
|
prepend_extend_hooks.push( new_set )
|
129
129
|
return new_set
|
130
130
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
module ModuleCluster::ClusterStack::PrependsIncludes
|
2
|
+
module ::ModuleCluster::ClusterStack::PrependsIncludes
|
3
3
|
|
4
4
|
##############################
|
5
5
|
# prepend_include_hooks #
|
@@ -14,7 +14,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
14
14
|
###############################
|
15
15
|
|
16
16
|
def include_prepends_includes( module_instance, method, includes, runtime_includes_block )
|
17
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include, includes, runtime_includes_block )
|
17
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include, includes, runtime_includes_block )
|
18
18
|
prepend_include_hooks.push( new_set )
|
19
19
|
return new_set
|
20
20
|
end
|
@@ -24,7 +24,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
24
24
|
##############################
|
25
25
|
|
26
26
|
def include_prepends_extends( module_instance, method, extends, runtime_extends_block )
|
27
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :extend, extends, runtime_extends_block )
|
27
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :extend, extends, runtime_extends_block )
|
28
28
|
prepend_include_hooks.push( new_set )
|
29
29
|
return new_set
|
30
30
|
end
|
@@ -34,7 +34,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
34
34
|
###########################################
|
35
35
|
|
36
36
|
def include_prepends_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
37
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
37
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
38
38
|
prepend_include_hooks.push( new_set )
|
39
39
|
return new_set
|
40
40
|
end
|
@@ -44,7 +44,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
44
44
|
######################################
|
45
45
|
|
46
46
|
def module_include_prepends_includes( module_instance, method, includes, runtime_includes_block )
|
47
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include, includes, runtime_includes_block )
|
47
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include, includes, runtime_includes_block )
|
48
48
|
prepend_include_hooks.push( new_set )
|
49
49
|
return new_set
|
50
50
|
end
|
@@ -54,7 +54,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
54
54
|
#####################################
|
55
55
|
|
56
56
|
def module_include_prepends_extends( module_instance, method, extends, runtime_extends_block )
|
57
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :extend, extends, runtime_extends_block )
|
57
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :extend, extends, runtime_extends_block )
|
58
58
|
prepend_include_hooks.push( new_set )
|
59
59
|
return new_set
|
60
60
|
end
|
@@ -64,7 +64,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
64
64
|
##################################################
|
65
65
|
|
66
66
|
def module_include_prepends_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
67
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
67
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
68
68
|
prepend_include_hooks.push( new_set )
|
69
69
|
return new_set
|
70
70
|
end
|
@@ -74,7 +74,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
74
74
|
#####################################
|
75
75
|
|
76
76
|
def class_include_prepends_includes( module_instance, method, includes, runtime_includes_block )
|
77
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include, includes, runtime_includes_block )
|
77
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include, includes, runtime_includes_block )
|
78
78
|
prepend_include_hooks.push( new_set )
|
79
79
|
return new_set
|
80
80
|
end
|
@@ -84,7 +84,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
84
84
|
####################################
|
85
85
|
|
86
86
|
def class_include_prepends_extends( module_instance, method, extends, runtime_extends_block )
|
87
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :extend, extends, runtime_extends_block )
|
87
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :extend, extends, runtime_extends_block )
|
88
88
|
prepend_include_hooks.push( new_set )
|
89
89
|
return new_set
|
90
90
|
end
|
@@ -94,7 +94,7 @@ module ModuleCluster::ClusterStack::PrependsIncludes
|
|
94
94
|
#################################################
|
95
95
|
|
96
96
|
def class_include_prepends_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
97
|
-
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
97
|
+
new_set = ::ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
98
98
|
prepend_include_hooks.push( new_set )
|
99
99
|
return new_set
|
100
100
|
end
|
data/lib/module-cluster.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
module ModuleCluster
|
2
|
+
module ::ModuleCluster
|
3
3
|
class ClusterStack
|
4
4
|
module Block
|
5
5
|
module Class
|
@@ -48,6 +48,14 @@ module ModuleCluster
|
|
48
48
|
end
|
49
49
|
module ModuleOrSubclass
|
50
50
|
end
|
51
|
+
module CascadingClass
|
52
|
+
end
|
53
|
+
module CascadingClassOrModule
|
54
|
+
end
|
55
|
+
module CascadingModule
|
56
|
+
end
|
57
|
+
module CascadingModuleOrSubclass
|
58
|
+
end
|
51
59
|
end
|
52
60
|
module ClusterStack
|
53
61
|
end
|
@@ -67,7 +75,7 @@ module ModuleCluster
|
|
67
75
|
end
|
68
76
|
module InstanceCluster
|
69
77
|
end
|
70
|
-
module ModuleCluster
|
78
|
+
module ::ModuleCluster
|
71
79
|
end
|
72
80
|
module ModuleOrClassCluster
|
73
81
|
end
|
@@ -133,6 +141,10 @@ require_relative 'module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubcl
|
|
133
141
|
require_relative 'module-cluster/ModuleCluster/Define/Block/Subclass.rb'
|
134
142
|
require_relative 'module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb'
|
135
143
|
require_relative 'module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb'
|
144
|
+
require_relative 'module-cluster/ModuleCluster/Define/Block/CascadingClass.rb'
|
145
|
+
require_relative 'module-cluster/ModuleCluster/Define/Block/CascadingModule.rb'
|
146
|
+
require_relative 'module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb'
|
147
|
+
require_relative 'module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb'
|
136
148
|
require_relative 'module-cluster/ModuleCluster/Define/Block.rb'
|
137
149
|
|
138
150
|
require_relative 'module-cluster/ModuleCluster/Define/Deprecated.rb'
|
@@ -0,0 +1,285 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/module-cluster.rb'
|
3
|
+
|
4
|
+
describe ::ModuleCluster::Define::Block::CascadingClassOrModule do
|
5
|
+
|
6
|
+
#######################################
|
7
|
+
# cascading_class_or_module_include #
|
8
|
+
#######################################
|
9
|
+
|
10
|
+
it 'can run a block on class or module include' do
|
11
|
+
module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
|
12
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule
|
13
|
+
block_ran = false
|
14
|
+
cascading_class_or_module_include do
|
15
|
+
block_ran = true
|
16
|
+
end
|
17
|
+
respond_to?( :included ).should == true
|
18
|
+
class ClassProofExtended
|
19
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
|
20
|
+
end
|
21
|
+
block_ran.should == false
|
22
|
+
class ClassProof
|
23
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
|
24
|
+
end
|
25
|
+
block_ran.should == true
|
26
|
+
block_ran = false
|
27
|
+
class ClassProof2 < ClassProof
|
28
|
+
end
|
29
|
+
block_ran.should == true
|
30
|
+
block_ran = false
|
31
|
+
Object.new.instance_eval do
|
32
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
|
33
|
+
end
|
34
|
+
block_ran.should == false
|
35
|
+
module ModuleProofExtended
|
36
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
|
37
|
+
end
|
38
|
+
block_ran.should == false
|
39
|
+
module ModuleProof
|
40
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
|
41
|
+
end
|
42
|
+
block_ran.should == true
|
43
|
+
block_ran = false
|
44
|
+
module ModuleProof2
|
45
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01::ModuleProof
|
46
|
+
end
|
47
|
+
block_ran.should == true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
######################################
|
52
|
+
# cascading_class_or_module_extend #
|
53
|
+
######################################
|
54
|
+
|
55
|
+
it 'can run a block on class or module extend' do
|
56
|
+
module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
|
57
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule
|
58
|
+
block_ran = false
|
59
|
+
cascading_class_or_module_extend do
|
60
|
+
block_ran = true
|
61
|
+
end
|
62
|
+
respond_to?( :extended ).should == true
|
63
|
+
class ClassProof
|
64
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
|
65
|
+
end
|
66
|
+
block_ran.should == false
|
67
|
+
class ClassProof2 < ClassProof
|
68
|
+
end
|
69
|
+
block_ran.should == true
|
70
|
+
block_ran = false
|
71
|
+
class ClassProofExtended
|
72
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
|
73
|
+
end
|
74
|
+
block_ran.should == true
|
75
|
+
block_ran = false
|
76
|
+
Object.new.instance_eval do
|
77
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
|
78
|
+
end
|
79
|
+
block_ran.should == false
|
80
|
+
module ModuleProof
|
81
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
|
82
|
+
end
|
83
|
+
block_ran.should == false
|
84
|
+
module ModuleProofExtended
|
85
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
|
86
|
+
end
|
87
|
+
block_ran.should == true
|
88
|
+
block_ran = false
|
89
|
+
module ModuleProofExtended2
|
90
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02::ModuleProofExtended
|
91
|
+
end
|
92
|
+
block_ran.should == true
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
#################################################
|
97
|
+
# cascading_class_or_module_include_or_extend #
|
98
|
+
#################################################
|
99
|
+
|
100
|
+
it 'can run a block on class or module include or extend' do
|
101
|
+
module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
|
102
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule
|
103
|
+
block_ran = false
|
104
|
+
cascading_class_or_module_include_or_extend do
|
105
|
+
block_ran = true
|
106
|
+
end
|
107
|
+
respond_to?( :extended ).should == true
|
108
|
+
class ClassProof
|
109
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
|
110
|
+
end
|
111
|
+
block_ran.should == true
|
112
|
+
block_ran = false
|
113
|
+
class ClassProof2 < ClassProof
|
114
|
+
end
|
115
|
+
block_ran.should == true
|
116
|
+
block_ran = false
|
117
|
+
class ClassProofExtended
|
118
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
|
119
|
+
end
|
120
|
+
block_ran.should == true
|
121
|
+
block_ran = false
|
122
|
+
Object.new.instance_eval do
|
123
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
|
124
|
+
end
|
125
|
+
block_ran.should == false
|
126
|
+
module ModuleProof
|
127
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
|
128
|
+
end
|
129
|
+
block_ran.should == true
|
130
|
+
block_ran = false
|
131
|
+
module ModuleProofExtended
|
132
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
|
133
|
+
end
|
134
|
+
block_ran.should == true
|
135
|
+
block_ran = false
|
136
|
+
module ModuleProofExtended2
|
137
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03::ModuleProofExtended
|
138
|
+
end
|
139
|
+
block_ran.should == true
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
###############################################
|
144
|
+
# cascading_prepend_class_or_module_include #
|
145
|
+
###############################################
|
146
|
+
|
147
|
+
it 'can run a block before class or module include' do
|
148
|
+
module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
|
149
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule
|
150
|
+
block_ran = false
|
151
|
+
cascading_prepend_class_or_module_include do
|
152
|
+
block_ran = true
|
153
|
+
end
|
154
|
+
respond_to?( :included ).should == true
|
155
|
+
class ClassProofExtended
|
156
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
|
157
|
+
end
|
158
|
+
block_ran.should == false
|
159
|
+
class ClassProof
|
160
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
|
161
|
+
end
|
162
|
+
block_ran.should == true
|
163
|
+
block_ran = false
|
164
|
+
class ClassProof2 < ClassProof
|
165
|
+
end
|
166
|
+
block_ran.should == true
|
167
|
+
block_ran = false
|
168
|
+
Object.new.instance_eval do
|
169
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
|
170
|
+
end
|
171
|
+
block_ran.should == false
|
172
|
+
module ModuleProofExtended
|
173
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
|
174
|
+
end
|
175
|
+
block_ran.should == false
|
176
|
+
module ModuleProof
|
177
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
|
178
|
+
end
|
179
|
+
block_ran.should == true
|
180
|
+
block_ran = false
|
181
|
+
module ModuleProof2
|
182
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04::ModuleProof
|
183
|
+
end
|
184
|
+
block_ran.should == true
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
##############################################
|
189
|
+
# cascading_prepend_class_or_module_extend #
|
190
|
+
##############################################
|
191
|
+
|
192
|
+
it 'can run a block before class or module extend' do
|
193
|
+
module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
|
194
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule
|
195
|
+
block_ran = false
|
196
|
+
cascading_prepend_class_or_module_extend do
|
197
|
+
block_ran = true
|
198
|
+
end
|
199
|
+
respond_to?( :extended ).should == true
|
200
|
+
class ClassProof
|
201
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
|
202
|
+
end
|
203
|
+
block_ran.should == false
|
204
|
+
class ClassProofExtended
|
205
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
|
206
|
+
end
|
207
|
+
block_ran.should == true
|
208
|
+
block_ran = false
|
209
|
+
class ClassProof2 < ClassProof
|
210
|
+
end
|
211
|
+
block_ran.should == true
|
212
|
+
block_ran = false
|
213
|
+
Object.new.instance_eval do
|
214
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
|
215
|
+
end
|
216
|
+
block_ran.should == false
|
217
|
+
module ModuleProof
|
218
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
|
219
|
+
end
|
220
|
+
block_ran.should == false
|
221
|
+
module ModuleProofExtended
|
222
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
|
223
|
+
end
|
224
|
+
block_ran.should == true
|
225
|
+
block_ran = false
|
226
|
+
module ModuleProofExtended2
|
227
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05::ModuleProofExtended
|
228
|
+
end
|
229
|
+
block_ran.should == true
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
#########################################################
|
234
|
+
# cascading_prepend_class_or_module_include_or_extend #
|
235
|
+
#########################################################
|
236
|
+
|
237
|
+
it 'can run a block before class or module include or extend' do
|
238
|
+
module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
|
239
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule
|
240
|
+
block_ran = false
|
241
|
+
cascading_prepend_class_or_module_include_or_extend do
|
242
|
+
block_ran = true
|
243
|
+
end
|
244
|
+
respond_to?( :extended ).should == true
|
245
|
+
class ClassProof
|
246
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
|
247
|
+
end
|
248
|
+
block_ran.should == true
|
249
|
+
block_ran = false
|
250
|
+
class ClassProofExtended
|
251
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
|
252
|
+
end
|
253
|
+
block_ran.should == true
|
254
|
+
block_ran = false
|
255
|
+
class ClassProof2 < ClassProof
|
256
|
+
end
|
257
|
+
block_ran.should == true
|
258
|
+
block_ran = false
|
259
|
+
Object.new.instance_eval do
|
260
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
|
261
|
+
end
|
262
|
+
block_ran.should == false
|
263
|
+
module ModuleProof
|
264
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
|
265
|
+
end
|
266
|
+
block_ran.should == true
|
267
|
+
block_ran = false
|
268
|
+
module ModuleProof2
|
269
|
+
include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06::ModuleProof
|
270
|
+
end
|
271
|
+
block_ran.should == true
|
272
|
+
block_ran = false
|
273
|
+
module ModuleProofExtended
|
274
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
|
275
|
+
end
|
276
|
+
block_ran.should == true
|
277
|
+
block_ran = false
|
278
|
+
module ModuleProofExtended2
|
279
|
+
extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06::ModuleProofExtended
|
280
|
+
end
|
281
|
+
block_ran.should == true
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
end
|