module-cluster 1.2.5 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +32 -32
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascades.rb +48 -48
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToClass.rb +48 -64
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToModule.rb +56 -56
- data/lib/module-cluster/ModuleCluster/Define/_private_/ClusterStack.rb +21 -7
- metadata +4 -4
@@ -8,12 +8,12 @@ module ModuleCluster::Define::ModuleCluster
|
|
8
8
|
###########################
|
9
9
|
|
10
10
|
def include_also_includes( *includes )
|
11
|
-
|
12
|
-
|
13
|
-
include(
|
11
|
+
unless ( includes -= ancestors ).empty?
|
12
|
+
includes_module = anonymous_module_for_included do
|
13
|
+
include( *includes.reverse )
|
14
14
|
end
|
15
|
+
clusterstack_module { include( includes_module ) }
|
15
16
|
end
|
16
|
-
clusterstack_module { include( includes_module ) }
|
17
17
|
return self
|
18
18
|
end
|
19
19
|
|
@@ -22,12 +22,12 @@ module ModuleCluster::Define::ModuleCluster
|
|
22
22
|
##########################
|
23
23
|
|
24
24
|
def include_also_extends( *extends )
|
25
|
-
|
26
|
-
|
27
|
-
extend(
|
25
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
26
|
+
extends_module = anonymous_module_for_included do
|
27
|
+
extend( *extends.reverse )
|
28
28
|
end
|
29
|
+
clusterstack_module { include( extends_module ) }
|
29
30
|
end
|
30
|
-
clusterstack_module { include( extends_module ) }
|
31
31
|
return self
|
32
32
|
end
|
33
33
|
|
@@ -46,12 +46,12 @@ module ModuleCluster::Define::ModuleCluster
|
|
46
46
|
##########################
|
47
47
|
|
48
48
|
def extend_also_includes( *includes )
|
49
|
-
|
50
|
-
|
51
|
-
include(
|
49
|
+
unless ( includes -= ancestors ).empty?
|
50
|
+
includes_module = anonymous_module_for_extended do
|
51
|
+
include( *includes.reverse )
|
52
52
|
end
|
53
|
+
clusterstack_module { include( includes_module ) }
|
53
54
|
end
|
54
|
-
clusterstack_module { include( includes_module ) }
|
55
55
|
return self
|
56
56
|
end
|
57
57
|
|
@@ -60,12 +60,12 @@ module ModuleCluster::Define::ModuleCluster
|
|
60
60
|
#########################
|
61
61
|
|
62
62
|
def extend_also_extends( *extends )
|
63
|
-
|
64
|
-
|
65
|
-
extend(
|
63
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
64
|
+
extends_module = anonymous_module_for_extended do
|
65
|
+
extend( *extends.reverse )
|
66
66
|
end
|
67
|
+
clusterstack_module { include( extends_module ) }
|
67
68
|
end
|
68
|
-
clusterstack_module { include( extends_module ) }
|
69
69
|
return self
|
70
70
|
end
|
71
71
|
|
@@ -84,12 +84,12 @@ module ModuleCluster::Define::ModuleCluster
|
|
84
84
|
###############################
|
85
85
|
|
86
86
|
def include_prepends_includes( *includes )
|
87
|
-
|
88
|
-
|
89
|
-
include(
|
87
|
+
unless ( includes -= ancestors ).empty?
|
88
|
+
includes_module = anonymous_module_for_append_features do
|
89
|
+
include( *includes.reverse )
|
90
90
|
end
|
91
|
+
clusterstack_module { include( includes_module ) }
|
91
92
|
end
|
92
|
-
clusterstack_module { include( includes_module ) }
|
93
93
|
return self
|
94
94
|
end
|
95
95
|
|
@@ -98,12 +98,12 @@ module ModuleCluster::Define::ModuleCluster
|
|
98
98
|
##############################
|
99
99
|
|
100
100
|
def include_prepends_extends( *extends )
|
101
|
-
|
102
|
-
|
103
|
-
extend(
|
101
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
102
|
+
extends_module = anonymous_module_for_append_features do
|
103
|
+
extend( *extends.reverse )
|
104
104
|
end
|
105
|
+
clusterstack_module { include( extends_module ) }
|
105
106
|
end
|
106
|
-
clusterstack_module { include( extends_module ) }
|
107
107
|
return self
|
108
108
|
end
|
109
109
|
|
@@ -122,12 +122,12 @@ module ModuleCluster::Define::ModuleCluster
|
|
122
122
|
##############################
|
123
123
|
|
124
124
|
def extend_prepends_includes( *includes )
|
125
|
-
|
126
|
-
|
127
|
-
include(
|
125
|
+
unless ( includes -= ancestors ).empty?
|
126
|
+
includes_module = anonymous_module_for_extend_object do
|
127
|
+
include( *includes.reverse )
|
128
128
|
end
|
129
|
+
clusterstack_module { include( includes_module ) }
|
129
130
|
end
|
130
|
-
clusterstack_module { include( includes_module ) }
|
131
131
|
return self
|
132
132
|
end
|
133
133
|
|
@@ -136,12 +136,12 @@ module ModuleCluster::Define::ModuleCluster
|
|
136
136
|
#############################
|
137
137
|
|
138
138
|
def extend_prepends_extends( *extends )
|
139
|
-
|
140
|
-
|
141
|
-
extend(
|
139
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
140
|
+
extends_module = anonymous_module_for_extend_object do
|
141
|
+
extend( *extends.reverse )
|
142
142
|
end
|
143
|
+
clusterstack_module { include( extends_module ) }
|
143
144
|
end
|
144
|
-
clusterstack_module { include( extends_module ) }
|
145
145
|
return self
|
146
146
|
end
|
147
147
|
|
@@ -8,14 +8,14 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
8
8
|
###############################
|
9
9
|
|
10
10
|
def include_cascades_includes( *includes )
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
include(
|
11
|
+
unless ( includes -= ancestors ).empty?
|
12
|
+
includes_module = anonymous_module_for_included( 'Cascades' ) do
|
13
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
14
|
+
include_cascades_includes( *includes )
|
15
|
+
include( *includes.reverse )
|
16
16
|
end
|
17
|
+
clusterstack_module { include( includes_module ) }
|
17
18
|
end
|
18
|
-
clusterstack_module { include( includes_module ) }
|
19
19
|
return self
|
20
20
|
end
|
21
21
|
|
@@ -24,14 +24,14 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
24
24
|
##############################
|
25
25
|
|
26
26
|
def include_cascades_extends( *extends )
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
extend(
|
27
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
28
|
+
extends_module = anonymous_module_for_included( 'Cascades' ) do
|
29
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
30
|
+
include_cascades_extends( *extends )
|
31
|
+
extend( *extends.reverse )
|
32
32
|
end
|
33
|
+
clusterstack_module { include( extends_module ) }
|
33
34
|
end
|
34
|
-
clusterstack_module { include( extends_module ) }
|
35
35
|
return self
|
36
36
|
end
|
37
37
|
|
@@ -50,14 +50,14 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
50
50
|
##############################
|
51
51
|
|
52
52
|
def extend_cascades_includes( *includes )
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
include(
|
53
|
+
unless ( includes -= ancestors ).empty?
|
54
|
+
includes_module = anonymous_module_for_extended( 'Cascades' ) do
|
55
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
56
|
+
extend_cascades_includes( *includes )
|
57
|
+
include( *includes.reverse )
|
58
58
|
end
|
59
|
+
clusterstack_module { include( includes_module ) }
|
59
60
|
end
|
60
|
-
clusterstack_module { include( includes_module ) }
|
61
61
|
return self
|
62
62
|
end
|
63
63
|
|
@@ -66,14 +66,14 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
66
66
|
#############################
|
67
67
|
|
68
68
|
def extend_cascades_extends( *extends )
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
extend(
|
69
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
70
|
+
extends_module = anonymous_module_for_extended( 'Cascades' ) do
|
71
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
72
|
+
extend_cascades_extends( *extends )
|
73
|
+
extend( *extends.reverse )
|
74
74
|
end
|
75
|
+
clusterstack_module { include( extends_module ) }
|
75
76
|
end
|
76
|
-
clusterstack_module { include( extends_module ) }
|
77
77
|
return self
|
78
78
|
end
|
79
79
|
|
@@ -92,14 +92,14 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
92
92
|
##########################################
|
93
93
|
|
94
94
|
def include_cascades_prepending_includes( *includes )
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
include(
|
95
|
+
unless ( includes -= ancestors ).empty?
|
96
|
+
includes_module = anonymous_module_for_append_features( 'Cascades' ) do
|
97
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
98
|
+
include_cascades_prepending_includes( *includes )
|
99
|
+
include( *includes.reverse )
|
100
100
|
end
|
101
|
+
clusterstack_module { include( includes_module ) }
|
101
102
|
end
|
102
|
-
clusterstack_module { include( includes_module ) }
|
103
103
|
return self
|
104
104
|
end
|
105
105
|
|
@@ -108,14 +108,14 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
108
108
|
#########################################
|
109
109
|
|
110
110
|
def include_cascades_prepending_extends( *extends )
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
extend(
|
111
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
112
|
+
extends_module = anonymous_module_for_append_features( 'Cascades' ) do
|
113
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
114
|
+
include_cascades_prepending_extends( *extends )
|
115
|
+
extend( *extends.reverse )
|
116
116
|
end
|
117
|
+
clusterstack_module { include( extends_module ) }
|
117
118
|
end
|
118
|
-
clusterstack_module { include( extends_module ) }
|
119
119
|
return self
|
120
120
|
end
|
121
121
|
|
@@ -134,14 +134,14 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
134
134
|
#########################################
|
135
135
|
|
136
136
|
def extend_cascades_prepending_includes( *includes )
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
include(
|
137
|
+
unless ( includes -= ancestors ).empty?
|
138
|
+
includes_module = anonymous_module_for_extend_object( 'Cascades' ) do
|
139
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
140
|
+
extend_cascades_prepending_includes( *includes )
|
141
|
+
include( *includes.reverse )
|
142
142
|
end
|
143
|
+
clusterstack_module { include( includes_module ) }
|
143
144
|
end
|
144
|
-
clusterstack_module { include( includes_module ) }
|
145
145
|
return self
|
146
146
|
end
|
147
147
|
|
@@ -150,14 +150,14 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
150
150
|
########################################
|
151
151
|
|
152
152
|
def extend_cascades_prepending_extends( *extends )
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
extend(
|
153
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
154
|
+
extends_module = anonymous_module_for_extend_object( 'Cascades' ) do
|
155
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
156
|
+
extend_cascades_prepending_extends( *extends )
|
157
|
+
extend( *extends.reverse )
|
158
158
|
end
|
159
|
+
clusterstack_module { include( extends_module ) }
|
159
160
|
end
|
160
|
-
clusterstack_module { include( extends_module ) }
|
161
161
|
return self
|
162
162
|
end
|
163
163
|
|
@@ -8,16 +8,14 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
8
8
|
########################################
|
9
9
|
|
10
10
|
def include_cascades_includes_to_class( *includes )
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
includes.
|
16
|
-
include( this_module )
|
17
|
-
end
|
11
|
+
unless ( includes -= ancestors ).empty?
|
12
|
+
includes_module = anonymous_module_for_included( 'CascadesToClass' ) do
|
13
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
14
|
+
include_cascades_includes_to_class( *includes )
|
15
|
+
include( *includes.reverse ) if is_a?( Class )
|
18
16
|
end
|
17
|
+
clusterstack_module { include( includes_module ) }
|
19
18
|
end
|
20
|
-
clusterstack_module { include( includes_module ) }
|
21
19
|
return self
|
22
20
|
end
|
23
21
|
|
@@ -26,16 +24,14 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
26
24
|
#######################################
|
27
25
|
|
28
26
|
def include_cascades_extends_to_class( *extends )
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
extends.
|
34
|
-
extend( this_module )
|
35
|
-
end
|
27
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
28
|
+
extends_module = anonymous_module_for_included( 'CascadesToClass' ) do
|
29
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
30
|
+
include_cascades_extends_to_class( *extends )
|
31
|
+
extend( *extends.reverse ) if is_a?( Class )
|
36
32
|
end
|
33
|
+
clusterstack_module { include( extends_module ) }
|
37
34
|
end
|
38
|
-
clusterstack_module { include( extends_module ) }
|
39
35
|
return self
|
40
36
|
end
|
41
37
|
|
@@ -54,16 +50,14 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
54
50
|
#######################################
|
55
51
|
|
56
52
|
def extend_cascades_includes_to_class( *includes )
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
includes.
|
62
|
-
include( this_module )
|
63
|
-
end
|
53
|
+
unless ( includes -= ancestors ).empty?
|
54
|
+
includes_module = anonymous_module_for_extended( 'CascadesToClass' ) do
|
55
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
56
|
+
extend_cascades_includes_to_class( *includes )
|
57
|
+
include( *includes.reverse ) if is_a?( Class )
|
64
58
|
end
|
59
|
+
clusterstack_module { include( includes_module ) }
|
65
60
|
end
|
66
|
-
clusterstack_module { include( includes_module ) }
|
67
61
|
return self
|
68
62
|
end
|
69
63
|
|
@@ -72,16 +66,14 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
72
66
|
######################################
|
73
67
|
|
74
68
|
def extend_cascades_extends_to_class( *extends )
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
extends.
|
80
|
-
extend( this_module )
|
81
|
-
end
|
69
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
70
|
+
extends_module = anonymous_module_for_extended( 'CascadesToClass' ) do
|
71
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
72
|
+
extend_cascades_extends_to_class( *extends )
|
73
|
+
extend( *extends.reverse ) if is_a?( Class )
|
82
74
|
end
|
75
|
+
clusterstack_module { include( extends_module ) }
|
83
76
|
end
|
84
|
-
clusterstack_module { include( extends_module ) }
|
85
77
|
return self
|
86
78
|
end
|
87
79
|
|
@@ -100,16 +92,14 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
100
92
|
###################################################
|
101
93
|
|
102
94
|
def include_cascades_to_class_prepending_includes( *includes )
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
includes.
|
108
|
-
include( this_module )
|
109
|
-
end
|
95
|
+
unless ( includes -= ancestors ).empty?
|
96
|
+
includes_module = anonymous_module_for_append_features( 'CascadesToClass' ) do
|
97
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
98
|
+
include_cascades_to_class_prepending_includes( *includes )
|
99
|
+
include( *includes.reverse ) if is_a?( Class )
|
110
100
|
end
|
101
|
+
clusterstack_module { include( includes_module ) }
|
111
102
|
end
|
112
|
-
clusterstack_module { include( includes_module ) }
|
113
103
|
return self
|
114
104
|
end
|
115
105
|
|
@@ -118,16 +108,14 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
118
108
|
##################################################
|
119
109
|
|
120
110
|
def include_cascades_to_class_prepending_extends( *extends )
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
extends.
|
126
|
-
extend( this_module )
|
127
|
-
end
|
111
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
112
|
+
extends_module = anonymous_module_for_append_features( 'CascadesToClass' ) do
|
113
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
114
|
+
include_cascades_to_class_prepending_extends( *extends )
|
115
|
+
extend( *extends.reverse ) if is_a?( Class )
|
128
116
|
end
|
117
|
+
clusterstack_module { include( extends_module ) }
|
129
118
|
end
|
130
|
-
clusterstack_module { include( extends_module ) }
|
131
119
|
return self
|
132
120
|
end
|
133
121
|
|
@@ -146,16 +134,14 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
146
134
|
##################################################
|
147
135
|
|
148
136
|
def extend_cascades_to_class_prepending_includes( *includes )
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
includes.
|
154
|
-
include( this_module )
|
155
|
-
end
|
137
|
+
unless ( includes -= ancestors ).empty?
|
138
|
+
includes_module = anonymous_module_for_extend_object( 'CascadesToClass' ) do
|
139
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
140
|
+
extend_cascades_to_class_prepending_includes( *includes )
|
141
|
+
include( *includes.reverse ) if is_a?( Class )
|
156
142
|
end
|
143
|
+
clusterstack_module { include( includes_module ) }
|
157
144
|
end
|
158
|
-
clusterstack_module { include( includes_module ) }
|
159
145
|
return self
|
160
146
|
end
|
161
147
|
|
@@ -164,16 +150,14 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
164
150
|
#################################################
|
165
151
|
|
166
152
|
def extend_cascades_to_class_prepending_extends( *extends )
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
extends.
|
172
|
-
extend( this_module )
|
173
|
-
end
|
153
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
154
|
+
extends_module = anonymous_module_for_extend_object( 'CascadesToClass' ) do
|
155
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
156
|
+
extend_cascades_to_class_prepending_extends( *extends )
|
157
|
+
extend( *extends.reverse ) if is_a?( Class )
|
174
158
|
end
|
159
|
+
clusterstack_module { include( extends_module ) }
|
175
160
|
end
|
176
|
-
clusterstack_module { include( extends_module ) }
|
177
161
|
return self
|
178
162
|
end
|
179
163
|
|
@@ -8,16 +8,16 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
8
8
|
#########################################
|
9
9
|
|
10
10
|
def include_cascades_includes_to_module( *includes )
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
include(
|
11
|
+
unless ( includes -= ancestors ).empty?
|
12
|
+
includes_module = anonymous_module_for_included( 'CascadesToModule' ) do
|
13
|
+
unless is_a?( Class )
|
14
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
15
|
+
include_cascades_includes_to_module( *includes )
|
16
|
+
include( *includes.reverse )
|
17
17
|
end
|
18
18
|
end
|
19
|
+
clusterstack_module { include( includes_module ) }
|
19
20
|
end
|
20
|
-
clusterstack_module { include( includes_module ) }
|
21
21
|
return self
|
22
22
|
end
|
23
23
|
|
@@ -26,16 +26,16 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
26
26
|
########################################
|
27
27
|
|
28
28
|
def include_cascades_extends_to_module( *extends )
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
extend(
|
29
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
30
|
+
extends_module = anonymous_module_for_included( 'CascadesToModule' ) do
|
31
|
+
unless is_a?( Class )
|
32
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
33
|
+
include_cascades_extends_to_module( *extends )
|
34
|
+
extend( *extends.reverse )
|
35
35
|
end
|
36
36
|
end
|
37
|
+
clusterstack_module { include( extends_module ) }
|
37
38
|
end
|
38
|
-
clusterstack_module { include( extends_module ) }
|
39
39
|
return self
|
40
40
|
end
|
41
41
|
|
@@ -54,16 +54,16 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
54
54
|
########################################
|
55
55
|
|
56
56
|
def extend_cascades_includes_to_module( *includes )
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
include(
|
57
|
+
unless ( includes -= ancestors ).empty?
|
58
|
+
includes_module = anonymous_module_for_extended( 'CascadesToModule' ) do
|
59
|
+
unless is_a?( Class )
|
60
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
61
|
+
extend_cascades_includes_to_module( *includes )
|
62
|
+
include( *includes.reverse )
|
63
63
|
end
|
64
64
|
end
|
65
|
+
clusterstack_module { include( includes_module ) }
|
65
66
|
end
|
66
|
-
clusterstack_module { include( includes_module ) }
|
67
67
|
return self
|
68
68
|
end
|
69
69
|
|
@@ -72,16 +72,16 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
72
72
|
#######################################
|
73
73
|
|
74
74
|
def extend_cascades_extends_to_module( *extends )
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
extend(
|
75
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
76
|
+
extends_module = anonymous_module_for_extended( 'CascadesToModule' ) do
|
77
|
+
unless is_a?( Class )
|
78
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
79
|
+
extend_cascades_extends_to_module( *extends )
|
80
|
+
extend( *extends.reverse )
|
81
81
|
end
|
82
82
|
end
|
83
|
+
clusterstack_module { include( extends_module ) }
|
83
84
|
end
|
84
|
-
clusterstack_module { include( extends_module ) }
|
85
85
|
return self
|
86
86
|
end
|
87
87
|
|
@@ -100,16 +100,16 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
100
100
|
####################################################
|
101
101
|
|
102
102
|
def include_cascades_to_module_prepending_includes( *includes )
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
include(
|
103
|
+
unless ( includes -= ancestors ).empty?
|
104
|
+
includes_module = anonymous_module_for_append_features( 'CascadesToModule' ) do
|
105
|
+
unless is_a?( Class )
|
106
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
107
|
+
include_cascades_to_module_prepending_includes( *includes )
|
108
|
+
include( *includes.reverse )
|
109
109
|
end
|
110
110
|
end
|
111
|
+
clusterstack_module { include( includes_module ) }
|
111
112
|
end
|
112
|
-
clusterstack_module { include( includes_module ) }
|
113
113
|
return self
|
114
114
|
end
|
115
115
|
|
@@ -118,16 +118,16 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
118
118
|
###################################################
|
119
119
|
|
120
120
|
def include_cascades_to_module_prepending_extends( *extends )
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
extend(
|
121
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
122
|
+
extends_module = anonymous_module_for_append_features( 'CascadesToModule' ) do
|
123
|
+
unless is_a?( Class )
|
124
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
125
|
+
include_cascades_to_module_prepending_extends( *extends )
|
126
|
+
extend( *extends.reverse )
|
127
127
|
end
|
128
128
|
end
|
129
|
+
clusterstack_module { include( extends_module ) }
|
129
130
|
end
|
130
|
-
clusterstack_module { include( extends_module ) }
|
131
131
|
return self
|
132
132
|
end
|
133
133
|
|
@@ -146,16 +146,16 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
146
146
|
###################################################
|
147
147
|
|
148
148
|
def extend_cascades_to_module_prepending_includes( *includes )
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
include(
|
149
|
+
unless ( includes -= ancestors ).empty?
|
150
|
+
includes_module = anonymous_module_for_extend_object( 'CascadesToModule' ) do
|
151
|
+
unless is_a?( Class )
|
152
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
153
|
+
extend_cascades_to_module_prepending_includes( *includes )
|
154
|
+
include( *includes.reverse )
|
155
155
|
end
|
156
156
|
end
|
157
|
+
clusterstack_module { include( includes_module ) }
|
157
158
|
end
|
158
|
-
clusterstack_module { include( includes_module ) }
|
159
159
|
return self
|
160
160
|
end
|
161
161
|
|
@@ -164,16 +164,16 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
164
164
|
##################################################
|
165
165
|
|
166
166
|
def extend_cascades_to_module_prepending_extends( *extends )
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
extend(
|
167
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
168
|
+
extends_module = anonymous_module_for_extend_object( 'CascadesToModule' ) do
|
169
|
+
unless is_a?( Class )
|
170
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
171
|
+
extend_cascades_to_module_prepending_extends( *extends )
|
172
|
+
extend( *extends.reverse )
|
173
173
|
end
|
174
174
|
end
|
175
|
+
clusterstack_module { include( extends_module ) }
|
175
176
|
end
|
176
|
-
clusterstack_module { include( extends_module ) }
|
177
177
|
return self
|
178
178
|
end
|
179
179
|
|
@@ -5,13 +5,24 @@ module ModuleCluster::Define::ClusterStack
|
|
5
5
|
private ###############################################################################################
|
6
6
|
###########################################################################################################
|
7
7
|
|
8
|
+
################
|
9
|
+
# eigenclass #
|
10
|
+
################
|
11
|
+
|
12
|
+
def eigenclass
|
13
|
+
return class << self ; self ; end
|
14
|
+
end
|
15
|
+
|
8
16
|
#########################
|
9
17
|
# clusterstack_module #
|
10
18
|
#########################
|
11
19
|
|
12
20
|
def clusterstack_module( & clusterstack_extend_include_block )
|
13
21
|
|
14
|
-
|
22
|
+
module_instance = nil
|
23
|
+
|
24
|
+
unless const_defined?( :ClusterStackModule ) and module_instance = const_get( :ClusterStackModule )
|
25
|
+
|
15
26
|
module_instance = Module.new do
|
16
27
|
|
17
28
|
#-------------------------#
|
@@ -25,16 +36,19 @@ module ModuleCluster::Define::ClusterStack
|
|
25
36
|
end
|
26
37
|
|
27
38
|
end
|
39
|
+
|
28
40
|
const_set( :ClusterStackModule, module_instance )
|
41
|
+
|
29
42
|
end
|
30
43
|
|
31
|
-
# we use a block so that we don't have to worry about re-extending each time
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
44
|
+
# we use a block so that we don't have to worry about manually re-extending each time
|
45
|
+
if block_given?
|
46
|
+
module_instance.module_eval( & clusterstack_extend_include_block )
|
47
|
+
# we have to re-extend each time so that new includes/extends apply to self
|
48
|
+
extend( module_instance )
|
49
|
+
end
|
36
50
|
|
37
|
-
return
|
51
|
+
return module_instance
|
38
52
|
|
39
53
|
end
|
40
54
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 1.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Asher
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-08-
|
17
|
+
date: 2011-08-03 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|