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.
@@ -8,12 +8,12 @@ module ModuleCluster::Define::ModuleCluster
8
8
  ###########################
9
9
 
10
10
  def include_also_includes( *includes )
11
- includes_module = anonymous_module_for_included do
12
- includes.each do |this_module|
13
- include( this_module )
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
- extends_module = anonymous_module_for_included do
26
- extends.each do |this_module|
27
- extend( this_module )
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
- includes_module = anonymous_module_for_extended do
50
- includes.each do |this_module|
51
- include( this_module )
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
- extends_module = anonymous_module_for_extended do
64
- extends.each do |this_module|
65
- extend( this_module )
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
- includes_module = anonymous_module_for_append_features do
88
- includes.each do |this_module|
89
- include( this_module )
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
- extends_module = anonymous_module_for_append_features do
102
- extends.each do |this_module|
103
- extend( this_module )
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
- includes_module = anonymous_module_for_extend_object do
126
- includes.each do |this_module|
127
- include( this_module )
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
- extends_module = anonymous_module_for_extend_object do
140
- extends.each do |this_module|
141
- extend( this_module )
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
- includes_module = anonymous_module_for_included( 'Cascades' ) do
12
- extend ModuleCluster::Define::ModuleClusterCascades
13
- include_cascades_includes( *includes )
14
- includes.each do |this_module|
15
- include( this_module )
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
- extends_module = anonymous_module_for_included( 'Cascades' ) do
28
- extend ModuleCluster::Define::ModuleClusterCascades
29
- include_cascades_extends( *extends )
30
- extends.each do |this_module|
31
- extend( this_module )
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
- includes_module = anonymous_module_for_extended( 'Cascades' ) do
54
- extend ModuleCluster::Define::ModuleClusterCascades
55
- extend_cascades_includes( *includes )
56
- includes.each do |this_module|
57
- include( this_module )
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
- extends_module = anonymous_module_for_extended( 'Cascades' ) do
70
- extend ModuleCluster::Define::ModuleClusterCascades
71
- extend_cascades_extends( *extends )
72
- extends.each do |this_module|
73
- extend( this_module )
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
- includes_module = anonymous_module_for_append_features( 'Cascades' ) do
96
- extend ModuleCluster::Define::ModuleClusterCascades
97
- include_cascades_prepending_includes( *includes )
98
- includes.each do |this_module|
99
- include( this_module )
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
- extends_module = anonymous_module_for_append_features( 'Cascades' ) do
112
- extend ModuleCluster::Define::ModuleClusterCascades
113
- include_cascades_prepending_extends( *extends )
114
- extends.each do |this_module|
115
- extend( this_module )
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
- includes_module = anonymous_module_for_extend_object( 'Cascades' ) do
138
- extend ModuleCluster::Define::ModuleClusterCascades
139
- extend_cascades_prepending_includes( *includes )
140
- includes.each do |this_module|
141
- include( this_module )
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
- extends_module = anonymous_module_for_extend_object( 'Cascades' ) do
154
- extend ModuleCluster::Define::ModuleClusterCascades
155
- extend_cascades_prepending_extends( *extends )
156
- extends.each do |this_module|
157
- extend( this_module )
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
- includes_module = anonymous_module_for_included( 'CascadesToClass' ) do
12
- extend ModuleCluster::Define::ModuleClusterCascadesToClass
13
- include_cascades_includes_to_class( *includes )
14
- if is_a?( Class )
15
- includes.each do |this_module|
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
- extends_module = anonymous_module_for_included( 'CascadesToClass' ) do
30
- extend ModuleCluster::Define::ModuleClusterCascadesToClass
31
- include_cascades_extends_to_class( *extends )
32
- if is_a?( Class )
33
- extends.each do |this_module|
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
- includes_module = anonymous_module_for_extended( 'CascadesToClass' ) do
58
- extend ModuleCluster::Define::ModuleClusterCascadesToClass
59
- extend_cascades_includes_to_class( *includes )
60
- if is_a?( Class )
61
- includes.each do |this_module|
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
- extends_module = anonymous_module_for_extended( 'CascadesToClass' ) do
76
- extend ModuleCluster::Define::ModuleClusterCascadesToClass
77
- extend_cascades_extends_to_class( *extends )
78
- if is_a?( Class )
79
- extends.each do |this_module|
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
- includes_module = anonymous_module_for_append_features( 'CascadesToClass' ) do
104
- extend ModuleCluster::Define::ModuleClusterCascadesToClass
105
- include_cascades_to_class_prepending_includes( *includes )
106
- if is_a?( Class )
107
- includes.each do |this_module|
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
- extends_module = anonymous_module_for_append_features( 'CascadesToClass' ) do
122
- extend ModuleCluster::Define::ModuleClusterCascadesToClass
123
- include_cascades_to_class_prepending_extends( *extends )
124
- if is_a?( Class )
125
- extends.each do |this_module|
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
- includes_module = anonymous_module_for_extend_object( 'CascadesToClass' ) do
150
- extend ModuleCluster::Define::ModuleClusterCascadesToClass
151
- extend_cascades_to_class_prepending_includes( *includes )
152
- if is_a?( Class )
153
- includes.each do |this_module|
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
- extends_module = anonymous_module_for_extend_object( 'CascadesToClass' ) do
168
- extend ModuleCluster::Define::ModuleClusterCascadesToClass
169
- extend_cascades_to_class_prepending_extends( *extends )
170
- if is_a?( Class )
171
- extends.each do |this_module|
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
- includes_module = anonymous_module_for_included( 'CascadesToModule' ) do
12
- unless is_a?( Class )
13
- extend ModuleCluster::Define::ModuleClusterCascadesToModule
14
- include_cascades_includes_to_module( *includes )
15
- includes.each do |this_module|
16
- include( this_module )
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
- extends_module = anonymous_module_for_included( 'CascadesToModule' ) do
30
- unless is_a?( Class )
31
- extend ModuleCluster::Define::ModuleClusterCascadesToModule
32
- include_cascades_extends_to_module( *extends )
33
- extends.each do |this_module|
34
- extend( this_module )
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
- includes_module = anonymous_module_for_extended( 'CascadesToModule' ) do
58
- unless is_a?( Class )
59
- extend ModuleCluster::Define::ModuleClusterCascadesToModule
60
- extend_cascades_includes_to_module( *includes )
61
- includes.each do |this_module|
62
- include( this_module )
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
- extends_module = anonymous_module_for_extended( 'CascadesToModule' ) do
76
- unless is_a?( Class )
77
- extend ModuleCluster::Define::ModuleClusterCascadesToModule
78
- extend_cascades_extends_to_module( *extends )
79
- extends.each do |this_module|
80
- extend( this_module )
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
- includes_module = anonymous_module_for_append_features( 'CascadesToModule' ) do
104
- unless is_a?( Class )
105
- extend ModuleCluster::Define::ModuleClusterCascadesToModule
106
- include_cascades_to_module_prepending_includes( *includes )
107
- includes.each do |this_module|
108
- include( this_module )
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
- extends_module = anonymous_module_for_append_features( 'CascadesToModule' ) do
122
- unless is_a?( Class )
123
- extend ModuleCluster::Define::ModuleClusterCascadesToModule
124
- include_cascades_to_module_prepending_extends( *extends )
125
- extends.each do |this_module|
126
- extend( this_module )
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
- includes_module = anonymous_module_for_extend_object( 'CascadesToModule' ) do
150
- unless is_a?( Class )
151
- extend ModuleCluster::Define::ModuleClusterCascadesToModule
152
- extend_cascades_to_module_prepending_includes( *includes )
153
- includes.each do |this_module|
154
- include( this_module )
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
- extends_module = anonymous_module_for_extend_object( 'CascadesToModule' ) do
168
- unless is_a?( Class )
169
- extend ModuleCluster::Define::ModuleClusterCascadesToModule
170
- extend_cascades_to_module_prepending_extends( *extends )
171
- extends.each do |this_module|
172
- extend( this_module )
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
- unless const_defined?( :ClusterStackModule )
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
- self::ClusterStackModule.module_eval( & clusterstack_extend_include_block ) if block_given?
33
-
34
- # we have to re-extend each time so that new includes/extends apply to self
35
- extend( self::ClusterStackModule )
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 self::ClusterStackModule
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
- - 2
8
- - 5
9
- version: 1.2.5
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-01 00:00:00 -04:00
17
+ date: 2011-08-03 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20