module-cluster 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/module-cluster.rb +17 -13
- data/lib/module-cluster/ModuleCluster.rb +8 -8
- data/lib/module-cluster/ModuleCluster/CascadeFeatures.rb +155 -0
- data/lib/module-cluster/ModuleCluster/ClusterStack.rb +102 -0
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +203 -0
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +220 -0
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +209 -0
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +209 -0
- data/lib/module-cluster/ModuleCluster/Define/ClusterStack.rb +26 -0
- data/lib/module-cluster/ModuleCluster/Define/DedoubleAncestors.rb +22 -0
- data/lib/module-cluster/ModuleCluster/ExtendForCascade.rb +15 -0
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +421 -0
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +432 -0
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +345 -0
- data/spec/ModuleCluster/Define/Cluster_spec.rb +275 -0
- data/spec/ModuleCluster_spec.rb +4 -4
- metadata +16 -14
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -211
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascades.rb +0 -223
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToClass.rb +0 -223
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToModule.rb +0 -227
- data/lib/module-cluster/ModuleCluster/Define/_private_/AnonymousModule.rb +0 -121
- data/lib/module-cluster/ModuleCluster/Define/_private_/ClusterStack.rb +0 -55
- data/spec/ModuleCluster/Define/ModuleClusterCascadesToClass_spec.rb +0 -421
- data/spec/ModuleCluster/Define/ModuleClusterCascadesToModule_spec.rb +0 -432
- data/spec/ModuleCluster/Define/ModuleClusterCascades_spec.rb +0 -345
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -275
- data/spec/ModuleCluster/Define/_private_/ClusterStack_spec.rb +0 -24
@@ -0,0 +1,220 @@
|
|
1
|
+
|
2
|
+
module ModuleCluster::Define::ClusterCascades
|
3
|
+
|
4
|
+
include ModuleCluster::Define::ClusterStack
|
5
|
+
|
6
|
+
extend ModuleCluster::ExtendForCascade
|
7
|
+
|
8
|
+
####################################
|
9
|
+
# self.should_include_or_extend? #
|
10
|
+
####################################
|
11
|
+
|
12
|
+
def self.should_include_or_extend?( class_or_module )
|
13
|
+
return true
|
14
|
+
end
|
15
|
+
|
16
|
+
##########################
|
17
|
+
# self.should_cascade? #
|
18
|
+
##########################
|
19
|
+
|
20
|
+
def self.should_cascade?( class_or_module )
|
21
|
+
return true
|
22
|
+
end
|
23
|
+
|
24
|
+
#######################################
|
25
|
+
# self.perform_includes_and_extends #
|
26
|
+
#######################################
|
27
|
+
|
28
|
+
def self.perform_includes_and_extends( class_or_module, set_stack )
|
29
|
+
class_or_module.module_eval do
|
30
|
+
include( *cascade_struct.includes.reverse ) unless includes.empty?
|
31
|
+
extend( *cascade_struct.extends.reverse ) unless extends.empty?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
###########################
|
36
|
+
# self.perform_cascades #
|
37
|
+
###########################
|
38
|
+
|
39
|
+
def self.perform_cascades( class_or_module, method, modules )
|
40
|
+
class_or_module.module_eval do
|
41
|
+
unless is_a?( Class )
|
42
|
+
extend ModuleCluster::Define::ClusterCascades
|
43
|
+
__send__( method, *modules )
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
###############################
|
49
|
+
# include_cascades_includes #
|
50
|
+
###############################
|
51
|
+
|
52
|
+
def include_cascades_includes( *includes, & runtime_includes_block )
|
53
|
+
cluster_stack.include_includes( ModuleCluster::Define::ClusterCascades, __method__, includes, runtime_includes_block )
|
54
|
+
return self
|
55
|
+
end
|
56
|
+
|
57
|
+
##############################
|
58
|
+
# include_cascades_extends #
|
59
|
+
##############################
|
60
|
+
|
61
|
+
def include_cascades_extends( *extends, & runtime_extends_block )
|
62
|
+
cluster_stack.include_extends( ModuleCluster::Define::ClusterCascades, __method__, extends, runtime_extends_block )
|
63
|
+
return self
|
64
|
+
end
|
65
|
+
|
66
|
+
###########################################
|
67
|
+
# include_cascades_includes_and_extends #
|
68
|
+
###########################################
|
69
|
+
|
70
|
+
def include_cascades_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
71
|
+
include_cascades_includes( *includes_and_extends, & runtime_includes_and_extends_block )
|
72
|
+
include_cascades_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
73
|
+
return self
|
74
|
+
end
|
75
|
+
|
76
|
+
##############################
|
77
|
+
# extend_cascades_includes #
|
78
|
+
##############################
|
79
|
+
|
80
|
+
def extend_cascades_includes( *includes, & runtime_includes_block )
|
81
|
+
cluster_stack.extend_includes( ModuleCluster::Define::ClusterCascades, __method__, includes, runtime_includes_block )
|
82
|
+
return self
|
83
|
+
end
|
84
|
+
|
85
|
+
#############################
|
86
|
+
# extend_cascades_extends #
|
87
|
+
#############################
|
88
|
+
|
89
|
+
def extend_cascades_extends( *extends, & runtime_extends_block )
|
90
|
+
cluster_stack.extend_extends( ModuleCluster::Define::ClusterCascades, __method__, extends, runtime_extends_block )
|
91
|
+
return self
|
92
|
+
end
|
93
|
+
|
94
|
+
##########################################
|
95
|
+
# extend_cascades_includes_and_extends #
|
96
|
+
##########################################
|
97
|
+
|
98
|
+
def extend_cascades_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
99
|
+
extend_cascades_includes( *includes_and_extends, & runtime_includes_and_extends_block )
|
100
|
+
extend_cascades_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
101
|
+
return self
|
102
|
+
end
|
103
|
+
|
104
|
+
##########################################
|
105
|
+
# include_cascades_prepending_includes #
|
106
|
+
##########################################
|
107
|
+
|
108
|
+
def include_cascades_prepending_includes( *includes, & runtime_includes_block )
|
109
|
+
cluster_stack.include_prepends_includes( ModuleCluster::Define::ClusterCascades, __method__, includes, runtime_includes_block )
|
110
|
+
return self
|
111
|
+
end
|
112
|
+
|
113
|
+
#########################################
|
114
|
+
# include_cascades_prepending_extends #
|
115
|
+
#########################################
|
116
|
+
|
117
|
+
def include_cascades_prepending_extends( *extends, & runtime_extends_block )
|
118
|
+
cluster_stack.include_prepends_extends( ModuleCluster::Define::ClusterCascades, __method__, extends, runtime_extends_block )
|
119
|
+
return self
|
120
|
+
end
|
121
|
+
|
122
|
+
######################################################
|
123
|
+
# include_cascades_prepending_includes_and_extends #
|
124
|
+
######################################################
|
125
|
+
|
126
|
+
def include_cascades_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
127
|
+
include_cascades_prepending_includes( *includes_and_extends, & runtime_includes_and_extends_block )
|
128
|
+
include_cascades_prepending_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
129
|
+
return self
|
130
|
+
end
|
131
|
+
|
132
|
+
#########################################
|
133
|
+
# extend_cascades_prepending_includes #
|
134
|
+
#########################################
|
135
|
+
|
136
|
+
def extend_cascades_prepending_includes( *includes, & runtime_includes_block )
|
137
|
+
cluster_stack.extend_prepends_includes( ModuleCluster::Define::ClusterCascades, __method__, includes, runtime_includes_block )
|
138
|
+
return self
|
139
|
+
end
|
140
|
+
|
141
|
+
########################################
|
142
|
+
# extend_cascades_prepending_extends #
|
143
|
+
########################################
|
144
|
+
|
145
|
+
def extend_cascades_prepending_extends( *extends, & runtime_extends_block )
|
146
|
+
cluster_stack.extend_prepends_extends( ModuleCluster::Define::ClusterCascades, __method__, extends, runtime_extends_block )
|
147
|
+
return self
|
148
|
+
end
|
149
|
+
|
150
|
+
#####################################################
|
151
|
+
# extend_cascades_prepending_includes_and_extends #
|
152
|
+
#####################################################
|
153
|
+
|
154
|
+
def extend_cascades_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
155
|
+
extend_cascades_prepending_includes( *includes_and_extends, & runtime_includes_and_extends_block )
|
156
|
+
extend_cascades_prepending_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
157
|
+
return self
|
158
|
+
end
|
159
|
+
|
160
|
+
#########################################
|
161
|
+
# include_or_extend_cascades_includes #
|
162
|
+
#########################################
|
163
|
+
|
164
|
+
def include_or_extend_cascades_includes( *includes, & runtime_includes_block )
|
165
|
+
include_cascades_includes( *includes, & runtime_includes_block )
|
166
|
+
extend_cascades_includes( *includes, & runtime_includes_block )
|
167
|
+
return self
|
168
|
+
end
|
169
|
+
|
170
|
+
########################################
|
171
|
+
# include_or_extend_cascades_extends #
|
172
|
+
########################################
|
173
|
+
|
174
|
+
def include_or_extend_cascades_extends( *extends, & runtime_extends_block )
|
175
|
+
include_cascades_extends( *extends, & runtime_extends_block )
|
176
|
+
extend_cascades_extends( *extends, & runtime_extends_block )
|
177
|
+
return self
|
178
|
+
end
|
179
|
+
|
180
|
+
#####################################################
|
181
|
+
# include_or_extend_cascades_includes_and_extends #
|
182
|
+
#####################################################
|
183
|
+
|
184
|
+
def include_or_extend_cascades_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
185
|
+
include_cascades_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
186
|
+
extend_cascades_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
187
|
+
return self
|
188
|
+
end
|
189
|
+
|
190
|
+
####################################################
|
191
|
+
# include_or_extend_cascades_prepending_includes #
|
192
|
+
####################################################
|
193
|
+
|
194
|
+
def include_or_extend_cascades_prepending_includes( *includes, & runtime_includes_block )
|
195
|
+
include_cascades_includes( *includes, & runtime_includes_block )
|
196
|
+
extend_cascades_includes( *includes, & runtime_includes_block )
|
197
|
+
return self
|
198
|
+
end
|
199
|
+
|
200
|
+
###################################################
|
201
|
+
# include_or_extend_cascades_prepending_extends #
|
202
|
+
###################################################
|
203
|
+
|
204
|
+
def include_or_extend_cascades_prepending_extends( *extends, & runtime_extends_block )
|
205
|
+
include_cascades_prepending_extends( *extends, & runtime_extends_block )
|
206
|
+
extend_cascades_prepending_extends( *extends, & runtime_extends_block )
|
207
|
+
return self
|
208
|
+
end
|
209
|
+
|
210
|
+
################################################################
|
211
|
+
# include_or_extend_cascades_prepending_includes_and_extends #
|
212
|
+
################################################################
|
213
|
+
|
214
|
+
def include_or_extend_cascades_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
215
|
+
include_cascades_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
216
|
+
extend_cascades_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
217
|
+
return self
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
|
2
|
+
module ModuleCluster::Define::ClusterCascadesToClass
|
3
|
+
|
4
|
+
include ModuleCluster::Define::ClusterStack
|
5
|
+
|
6
|
+
extend ModuleCluster::ExtendForCascade
|
7
|
+
|
8
|
+
####################################
|
9
|
+
# self.should_include_or_extend? #
|
10
|
+
####################################
|
11
|
+
|
12
|
+
def self.should_include_or_extend?( class_or_module )
|
13
|
+
return class_or_module.is_a?( Class )
|
14
|
+
end
|
15
|
+
|
16
|
+
##########################
|
17
|
+
# self.should_cascade? #
|
18
|
+
##########################
|
19
|
+
|
20
|
+
def self.should_cascade?( class_or_module )
|
21
|
+
return ! class_or_module.is_a?( Class )
|
22
|
+
end
|
23
|
+
|
24
|
+
###########################
|
25
|
+
# self.perform_cascades #
|
26
|
+
###########################
|
27
|
+
|
28
|
+
def self.perform_cascades( class_or_module, method, modules )
|
29
|
+
class_or_module.module_eval do
|
30
|
+
unless is_a?( Class )
|
31
|
+
extend ModuleCluster::Define::ClusterCascadesToClass
|
32
|
+
__send__( method, *modules )
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
########################################
|
38
|
+
# include_cascades_includes_to_class #
|
39
|
+
########################################
|
40
|
+
|
41
|
+
def include_cascades_includes_to_class( *includes, & runtime_includes_block )
|
42
|
+
cluster_stack.include_includes( ModuleCluster::Define::ClusterCascadesToClass, __method__, includes, runtime_includes_block )
|
43
|
+
return self
|
44
|
+
end
|
45
|
+
|
46
|
+
#######################################
|
47
|
+
# include_cascades_extends_to_class #
|
48
|
+
#######################################
|
49
|
+
|
50
|
+
def include_cascades_extends_to_class( *extends, & runtime_extends_block )
|
51
|
+
cluster_stack.include_extends( ModuleCluster::Define::ClusterCascadesToClass, __method__, extends, runtime_extends_block )
|
52
|
+
return self
|
53
|
+
end
|
54
|
+
|
55
|
+
####################################################
|
56
|
+
# include_cascades_includes_and_extends_to_class #
|
57
|
+
####################################################
|
58
|
+
|
59
|
+
def include_cascades_includes_and_extends_to_class( *includes_and_extends, & runtime_includes_and_extends_block )
|
60
|
+
include_cascades_includes_to_class( *includes_and_extends, & runtime_includes_and_extends_block )
|
61
|
+
include_cascades_extends_to_class( *includes_and_extends, & runtime_includes_and_extends_block )
|
62
|
+
return self
|
63
|
+
end
|
64
|
+
|
65
|
+
#######################################
|
66
|
+
# extend_cascades_includes_to_class #
|
67
|
+
#######################################
|
68
|
+
|
69
|
+
def extend_cascades_includes_to_class( *includes, & runtime_includes_block )
|
70
|
+
cluster_stack.extend_includes( ModuleCluster::Define::ClusterCascadesToClass, __method__, includes, runtime_includes_block )
|
71
|
+
return self
|
72
|
+
end
|
73
|
+
|
74
|
+
######################################
|
75
|
+
# extend_cascades_extends_to_class #
|
76
|
+
######################################
|
77
|
+
|
78
|
+
def extend_cascades_extends_to_class( *extends, & runtime_extends_block )
|
79
|
+
cluster_stack.extend_extends( ModuleCluster::Define::ClusterCascadesToClass, __method__, extends, runtime_extends_block )
|
80
|
+
return self
|
81
|
+
end
|
82
|
+
|
83
|
+
###################################################
|
84
|
+
# extend_cascades_includes_and_extends_to_class #
|
85
|
+
###################################################
|
86
|
+
|
87
|
+
def extend_cascades_includes_and_extends_to_class( *includes_and_extends, & runtime_includes_and_extends_block )
|
88
|
+
extend_cascades_includes_to_class( *includes_and_extends, & runtime_includes_and_extends_block )
|
89
|
+
extend_cascades_extends_to_class( *includes_and_extends, & runtime_includes_and_extends_block )
|
90
|
+
return self
|
91
|
+
end
|
92
|
+
|
93
|
+
###################################################
|
94
|
+
# include_cascades_to_class_prepending_includes #
|
95
|
+
###################################################
|
96
|
+
|
97
|
+
def include_cascades_to_class_prepending_includes( *includes, & runtime_includes_block )
|
98
|
+
cluster_stack.include_prepends_includes( ModuleCluster::Define::ClusterCascadesToClass, __method__, includes, runtime_includes_block )
|
99
|
+
return self
|
100
|
+
end
|
101
|
+
|
102
|
+
##################################################
|
103
|
+
# include_cascades_to_class_prepending_extends #
|
104
|
+
##################################################
|
105
|
+
|
106
|
+
def include_cascades_to_class_prepending_extends( *extends, & runtime_extends_block )
|
107
|
+
cluster_stack.include_prepends_extends( ModuleCluster::Define::ClusterCascadesToClass, __method__, extends, runtime_extends_block )
|
108
|
+
return self
|
109
|
+
end
|
110
|
+
|
111
|
+
###############################################################
|
112
|
+
# include_cascades_to_class_prepending_includes_and_extends #
|
113
|
+
###############################################################
|
114
|
+
|
115
|
+
def include_cascades_to_class_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
116
|
+
include_cascades_to_class_prepending_includes( *includes_and_extends, & runtime_includes_and_extends_block )
|
117
|
+
include_cascades_to_class_prepending_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
118
|
+
return self
|
119
|
+
end
|
120
|
+
|
121
|
+
##################################################
|
122
|
+
# extend_cascades_to_class_prepending_includes #
|
123
|
+
##################################################
|
124
|
+
|
125
|
+
def extend_cascades_to_class_prepending_includes( *includes, & runtime_includes_block )
|
126
|
+
cluster_stack.extend_prepends_includes( ModuleCluster::Define::ClusterCascadesToClass, __method__, includes, runtime_includes_block )
|
127
|
+
return self
|
128
|
+
end
|
129
|
+
|
130
|
+
#################################################
|
131
|
+
# extend_cascades_to_class_prepending_extends #
|
132
|
+
#################################################
|
133
|
+
|
134
|
+
def extend_cascades_to_class_prepending_extends( *extends, & runtime_extends_block )
|
135
|
+
cluster_stack.extend_prepends_extends( ModuleCluster::Define::ClusterCascadesToClass, __method__, extends, runtime_extends_block )
|
136
|
+
return self
|
137
|
+
end
|
138
|
+
|
139
|
+
##############################################################
|
140
|
+
# extend_cascades_to_class_prepending_includes_and_extends #
|
141
|
+
##############################################################
|
142
|
+
|
143
|
+
def extend_cascades_to_class_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
144
|
+
extend_cascades_to_class_prepending_includes( *includes_and_extends, & runtime_includes_and_extends_block )
|
145
|
+
extend_cascades_to_class_prepending_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
146
|
+
return self
|
147
|
+
end
|
148
|
+
|
149
|
+
##################################################
|
150
|
+
# include_or_extend_cascades_includes_to_class #
|
151
|
+
##################################################
|
152
|
+
|
153
|
+
def include_or_extend_cascades_includes_to_class( *includes, & runtime_includes_block )
|
154
|
+
include_cascades_includes_to_class( *includes, & runtime_includes_block )
|
155
|
+
extend_cascades_includes_to_class( *includes, & runtime_includes_block )
|
156
|
+
return self
|
157
|
+
end
|
158
|
+
|
159
|
+
#################################################
|
160
|
+
# include_or_extend_cascades_extends_to_class #
|
161
|
+
#################################################
|
162
|
+
|
163
|
+
def include_or_extend_cascades_extends_to_class( *extends, & runtime_extends_block )
|
164
|
+
include_cascades_extends_to_class( *extends, & runtime_extends_block )
|
165
|
+
extend_cascades_extends_to_class( *extends, & runtime_extends_block )
|
166
|
+
return self
|
167
|
+
end
|
168
|
+
|
169
|
+
##############################################################
|
170
|
+
# include_or_extend_cascades_includes_and_extends_to_class #
|
171
|
+
##############################################################
|
172
|
+
|
173
|
+
def include_or_extend_cascades_includes_and_extends_to_class( *includes_and_extends, & runtime_includes_and_extends_block )
|
174
|
+
include_cascades_to_class_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
175
|
+
extend_cascades_to_class_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
176
|
+
return self
|
177
|
+
end
|
178
|
+
|
179
|
+
#############################################################
|
180
|
+
# include_or_extend_cascades_to_class_prepending_includes #
|
181
|
+
#############################################################
|
182
|
+
|
183
|
+
def include_or_extend_cascades_to_class_prepending_includes( *includes, & runtime_includes_block )
|
184
|
+
include_cascades_to_class_prepending_includes( *includes, & runtime_includes_block )
|
185
|
+
extend_cascades_to_class_prepending_includes( *includes, & runtime_includes_block )
|
186
|
+
return self
|
187
|
+
end
|
188
|
+
|
189
|
+
############################################################
|
190
|
+
# include_or_extend_cascades_to_class_prepending_extends #
|
191
|
+
############################################################
|
192
|
+
|
193
|
+
def include_or_extend_cascades_to_class_prepending_extends( *extends, & runtime_extends_block )
|
194
|
+
include_cascades_to_class_prepending_includes( *extends, & runtime_extends_block )
|
195
|
+
extend_cascades_to_class_prepending_includes( *extends, & runtime_extends_block )
|
196
|
+
return self
|
197
|
+
end
|
198
|
+
|
199
|
+
#########################################################################
|
200
|
+
# include_or_extend_cascades_to_class_prepending_includes_and_extends #
|
201
|
+
#########################################################################
|
202
|
+
|
203
|
+
def include_or_extend_cascades_to_class_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
204
|
+
include_cascades_to_class_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
205
|
+
extend_cascades_to_class_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
206
|
+
return self
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
|
2
|
+
module ModuleCluster::Define::ClusterCascadesToModule
|
3
|
+
|
4
|
+
include ModuleCluster::Define::ClusterStack
|
5
|
+
|
6
|
+
extend ModuleCluster::ExtendForCascade
|
7
|
+
|
8
|
+
####################################
|
9
|
+
# self.should_include_or_extend? #
|
10
|
+
####################################
|
11
|
+
|
12
|
+
def self.should_include_or_extend?( class_or_module )
|
13
|
+
return ! class_or_module.is_a?( Class )
|
14
|
+
end
|
15
|
+
|
16
|
+
##########################
|
17
|
+
# self.should_cascade? #
|
18
|
+
##########################
|
19
|
+
|
20
|
+
def self.should_cascade?( class_or_module )
|
21
|
+
return ! class_or_module.is_a?( Class )
|
22
|
+
end
|
23
|
+
|
24
|
+
###########################
|
25
|
+
# self.perform_cascades #
|
26
|
+
###########################
|
27
|
+
|
28
|
+
def self.perform_cascades( class_or_module, method, modules )
|
29
|
+
class_or_module.module_eval do
|
30
|
+
unless is_a?( Class )
|
31
|
+
extend ModuleCluster::Define::ClusterCascadesToModule
|
32
|
+
__send__( method, *modules )
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
#########################################
|
38
|
+
# include_cascades_includes_to_module #
|
39
|
+
#########################################
|
40
|
+
|
41
|
+
def include_cascades_includes_to_module( *includes, & runtime_includes_block )
|
42
|
+
cluster_stack.include_includes( ModuleCluster::Define::ClusterCascadesToModule, __method__, includes, runtime_includes_block )
|
43
|
+
return self
|
44
|
+
end
|
45
|
+
|
46
|
+
########################################
|
47
|
+
# include_cascades_extends_to_module #
|
48
|
+
########################################
|
49
|
+
|
50
|
+
def include_cascades_extends_to_module( *extends, & runtime_extends_block )
|
51
|
+
cluster_stack.include_extends( ModuleCluster::Define::ClusterCascadesToModule, __method__, extends, runtime_extends_block )
|
52
|
+
return self
|
53
|
+
end
|
54
|
+
|
55
|
+
#####################################################
|
56
|
+
# include_cascades_includes_and_extends_to_module #
|
57
|
+
#####################################################
|
58
|
+
|
59
|
+
def include_cascades_includes_and_extends_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
60
|
+
include_cascades_includes_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
61
|
+
include_cascades_extends_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
62
|
+
return self
|
63
|
+
end
|
64
|
+
|
65
|
+
########################################
|
66
|
+
# extend_cascades_includes_to_module #
|
67
|
+
########################################
|
68
|
+
|
69
|
+
def extend_cascades_includes_to_module( *includes, & runtime_includes_block )
|
70
|
+
cluster_stack.extend_includes( ModuleCluster::Define::ClusterCascadesToModule, __method__, includes, runtime_includes_block )
|
71
|
+
return self
|
72
|
+
end
|
73
|
+
|
74
|
+
#######################################
|
75
|
+
# extend_cascades_extends_to_module #
|
76
|
+
#######################################
|
77
|
+
|
78
|
+
def extend_cascades_extends_to_module( *extends, & runtime_extends_block )
|
79
|
+
cluster_stack.extend_extends( ModuleCluster::Define::ClusterCascadesToModule, __method__, extends, runtime_extends_block )
|
80
|
+
return self
|
81
|
+
end
|
82
|
+
|
83
|
+
####################################################
|
84
|
+
# extend_cascades_includes_and_extends_to_module #
|
85
|
+
####################################################
|
86
|
+
|
87
|
+
def extend_cascades_includes_and_extends_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
88
|
+
extend_cascades_includes_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
89
|
+
extend_cascades_extends_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
90
|
+
return self
|
91
|
+
end
|
92
|
+
|
93
|
+
####################################################
|
94
|
+
# include_cascades_to_module_prepending_includes #
|
95
|
+
####################################################
|
96
|
+
|
97
|
+
def include_cascades_to_module_prepending_includes( *includes, & runtime_includes_block )
|
98
|
+
cluster_stack.include_prepends_includes( ModuleCluster::Define::ClusterCascadesToModule, __method__, includes, runtime_includes_block )
|
99
|
+
return self
|
100
|
+
end
|
101
|
+
|
102
|
+
###################################################
|
103
|
+
# include_cascades_to_module_prepending_extends #
|
104
|
+
###################################################
|
105
|
+
|
106
|
+
def include_cascades_to_module_prepending_extends( *extends, & runtime_extends_block )
|
107
|
+
cluster_stack.include_prepends_extends( ModuleCluster::Define::ClusterCascadesToModule, __method__, extends, runtime_extends_block )
|
108
|
+
return self
|
109
|
+
end
|
110
|
+
|
111
|
+
################################################################
|
112
|
+
# include_cascades_to_module_prepending_includes_and_extends #
|
113
|
+
################################################################
|
114
|
+
|
115
|
+
def include_cascades_to_module_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
116
|
+
include_cascades_to_module_prepending_includes( *includes_and_extends, & runtime_includes_and_extends_block )
|
117
|
+
include_cascades_to_module_prepending_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
118
|
+
return self
|
119
|
+
end
|
120
|
+
|
121
|
+
###################################################
|
122
|
+
# extend_cascades_to_module_prepending_includes #
|
123
|
+
###################################################
|
124
|
+
|
125
|
+
def extend_cascades_to_module_prepending_includes( *includes, & runtime_includes_block )
|
126
|
+
cluster_stack.extend_prepends_includes( ModuleCluster::Define::ClusterCascadesToModule, __method__, includes, runtime_includes_block )
|
127
|
+
return self
|
128
|
+
end
|
129
|
+
|
130
|
+
##################################################
|
131
|
+
# extend_cascades_to_module_prepending_extends #
|
132
|
+
##################################################
|
133
|
+
|
134
|
+
def extend_cascades_to_module_prepending_extends( *extends, & runtime_extends_block )
|
135
|
+
cluster_stack.extend_prepends_extends( ModuleCluster::Define::ClusterCascadesToModule, __method__, extends, runtime_extends_block )
|
136
|
+
return self
|
137
|
+
end
|
138
|
+
|
139
|
+
###############################################################
|
140
|
+
# extend_cascades_to_module_prepending_includes_and_extends #
|
141
|
+
###############################################################
|
142
|
+
|
143
|
+
def extend_cascades_to_module_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
144
|
+
extend_cascades_to_module_prepending_includes( *includes_and_extends, & runtime_includes_and_extends_block )
|
145
|
+
extend_cascades_to_module_prepending_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
146
|
+
return self
|
147
|
+
end
|
148
|
+
|
149
|
+
###################################################
|
150
|
+
# include_or_extend_cascades_includes_to_module #
|
151
|
+
###################################################
|
152
|
+
|
153
|
+
def include_or_extend_cascades_includes_to_module( *includes, & runtime_includes_block )
|
154
|
+
include_cascades_includes_to_module( *includes, & runtime_includes_block )
|
155
|
+
extend_cascades_includes_to_module( *includes, & runtime_includes_block )
|
156
|
+
return self
|
157
|
+
end
|
158
|
+
|
159
|
+
##################################################
|
160
|
+
# include_or_extend_cascades_extends_to_module #
|
161
|
+
##################################################
|
162
|
+
|
163
|
+
def include_or_extend_cascades_extends_to_module( *extends, & runtime_extends_block )
|
164
|
+
include_cascades_extends_to_module( *extends, & runtime_extends_block )
|
165
|
+
extend_cascades_extends_to_module( *extends, & runtime_extends_block )
|
166
|
+
return self
|
167
|
+
end
|
168
|
+
|
169
|
+
###############################################################
|
170
|
+
# include_or_extend_cascades_includes_and_extends_to_module #
|
171
|
+
###############################################################
|
172
|
+
|
173
|
+
def include_or_extend_cascades_includes_and_extends_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
174
|
+
include_cascades_includes_and_extends_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
175
|
+
extend_cascades_includes_and_extends_to_module( *includes_and_extends, & runtime_includes_and_extends_block )
|
176
|
+
return self
|
177
|
+
end
|
178
|
+
|
179
|
+
##############################################################
|
180
|
+
# include_or_extend_cascades_to_module_prepending_includes #
|
181
|
+
##############################################################
|
182
|
+
|
183
|
+
def include_or_extend_cascades_to_module_prepending_includes( *includes, & runtime_includes_block )
|
184
|
+
include_cascades_to_module_prepending_includes( *includes, & runtime_includes_block )
|
185
|
+
extend_cascades_to_module_prepending_includes( *includes, & runtime_includes_block )
|
186
|
+
return self
|
187
|
+
end
|
188
|
+
|
189
|
+
#############################################################
|
190
|
+
# include_or_extend_cascades_to_module_prepending_extends #
|
191
|
+
#############################################################
|
192
|
+
|
193
|
+
def include_or_extend_cascades_to_module_prepending_extends( *extends, & runtime_extends_block )
|
194
|
+
include_cascades_to_module_prepending_extends( *extends, & runtime_extends_block )
|
195
|
+
extend_cascades_to_module_prepending_extends( *extends, & runtime_extends_block )
|
196
|
+
return self
|
197
|
+
end
|
198
|
+
|
199
|
+
##########################################################################
|
200
|
+
# include_or_extend_cascades_to_module_prepending_includes_and_extends #
|
201
|
+
##########################################################################
|
202
|
+
|
203
|
+
def include_or_extend_cascades_to_module_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
204
|
+
include_cascades_to_module_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
205
|
+
extend_cascades_to_module_prepending_includes_and_extends( *includes_and_extends, & runtime_includes_and_extends_block )
|
206
|
+
return self
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|