module-cluster 1.2.2 → 1.2.3
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 +43 -9
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascades.rb +58 -8
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToClass.rb +74 -8
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToModule.rb +74 -8
- data/lib/module-cluster/ModuleCluster/Define/_private_/AnonymousModule.rb +121 -0
- data/lib/module-cluster/ModuleCluster/Define/_private_/ClusterStack.rb +15 -2
- data/lib/module-cluster.rb +6 -6
- metadata +3 -10
- data/lib/module-cluster/ModuleCluster/Define/_private_/ModuleCluster.rb +0 -110
- data/lib/module-cluster/ModuleCluster/Define/_private_/ModuleClusterCascades.rb +0 -118
- data/lib/module-cluster/ModuleCluster/Define/_private_/ModuleClusterCascadesToClass.rb +0 -126
- data/lib/module-cluster/ModuleCluster/Define/_private_/ModuleClusterCascadesToModule.rb +0 -126
- data/spec/ModuleCluster/Define/_private_/ModuleClusterCascadesToClass_spec.rb +0 -249
- data/spec/ModuleCluster/Define/_private_/ModuleClusterCascadesToModule_spec.rb +0 -266
- data/spec/ModuleCluster/Define/_private_/ModuleClusterCascades_spec.rb +0 -223
- data/spec/ModuleCluster/Define/_private_/ModuleCluster_spec.rb +0 -168
@@ -1,249 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative '../../../../lib/module-cluster.rb'
|
3
|
-
|
4
|
-
describe ModuleCluster::Define::ModuleClusterCascadesToClass do
|
5
|
-
|
6
|
-
#######################################################
|
7
|
-
# anonymous_module_cascade_to_class_append_features #
|
8
|
-
#######################################################
|
9
|
-
|
10
|
-
it 'it can construct an anonymous module each time requested to append features with modules' do
|
11
|
-
class ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01
|
12
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
13
|
-
module Module1
|
14
|
-
end
|
15
|
-
module Module2
|
16
|
-
end
|
17
|
-
anonymous_module_cascade_to_class_append_features_instance = anonymous_module_cascade_to_class_append_features( :include, Module1, Module2 )
|
18
|
-
anonymous_module_cascade_to_class_append_features_instance.is_a?( Module ).should == true
|
19
|
-
anonymous_module_cascade_to_class_append_features_instance.instance_methods.include?( :append_features ).should == true
|
20
|
-
module SomeModule
|
21
|
-
end
|
22
|
-
SomeModule.extend( anonymous_module_cascade_to_class_append_features_instance )
|
23
|
-
SomeModule.respond_to?( :append_features ).should == true
|
24
|
-
module SomeOtherModule
|
25
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::SomeModule
|
26
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module1 ).should == false
|
27
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ).should == false
|
28
|
-
end
|
29
|
-
module Cascade1
|
30
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::SomeOtherModule
|
31
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module1 ).should == false
|
32
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ).should == false
|
33
|
-
end
|
34
|
-
class CascadeClass1
|
35
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Cascade1
|
36
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module1 ).should == true
|
37
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ).should == true
|
38
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ) ).should == true
|
39
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::SomeModule ) ).should == true
|
40
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::SomeModule ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::SomeOtherModule ) ).should == true
|
41
|
-
end
|
42
|
-
anonymous_module_cascade_to_class_append_features_instance2 = anonymous_module_cascade_to_class_append_features( :extend, Module1, Module2 )
|
43
|
-
anonymous_module_cascade_to_class_append_features_instance2.should_not == anonymous_module_cascade_to_class_append_features_instance
|
44
|
-
module AnotherModule
|
45
|
-
end
|
46
|
-
AnotherModule.extend( anonymous_module_cascade_to_class_append_features_instance2 )
|
47
|
-
AnotherModule.respond_to?( :append_features ).should == true
|
48
|
-
module YetAnotherModule
|
49
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::AnotherModule
|
50
|
-
eigenclass = class << self ; self ; end
|
51
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module1 ).should == false
|
52
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ).should == false
|
53
|
-
end
|
54
|
-
module Cascade2
|
55
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::YetAnotherModule
|
56
|
-
eigenclass = class << self ; self ; end
|
57
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module1 ).should == false
|
58
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ).should == false
|
59
|
-
end
|
60
|
-
class CascadeClass2
|
61
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Cascade2
|
62
|
-
eigenclass = class << self ; self ; end
|
63
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module1 ).should == true
|
64
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ).should == true
|
65
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock01::Module2 ) ).should == true
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
################################################
|
71
|
-
# anonymous_module_cascade_to_class_included #
|
72
|
-
################################################
|
73
|
-
|
74
|
-
it 'it can construct an anonymous module each time requested to include with modules' do
|
75
|
-
class ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02
|
76
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
77
|
-
module Module1
|
78
|
-
end
|
79
|
-
module Module2
|
80
|
-
end
|
81
|
-
anonymous_module_cascade_to_class_included_instance = anonymous_module_cascade_to_class_included( :include, Module1, Module2 )
|
82
|
-
anonymous_module_cascade_to_class_included_instance.is_a?( Module ).should == true
|
83
|
-
anonymous_module_cascade_to_class_included_instance.instance_methods.include?( :included ).should == true
|
84
|
-
module SomeModule
|
85
|
-
end
|
86
|
-
SomeModule.extend( anonymous_module_cascade_to_class_included_instance )
|
87
|
-
SomeModule.respond_to?( :included ).should == true
|
88
|
-
module SomeOtherModule
|
89
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::SomeModule
|
90
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module1 ).should == false
|
91
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module2 ).should == false
|
92
|
-
end
|
93
|
-
module Cascade1
|
94
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::SomeOtherModule
|
95
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module1 ).should == false
|
96
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module2 ).should == false
|
97
|
-
end
|
98
|
-
class CascadeClass1
|
99
|
-
end
|
100
|
-
anonymous_module_cascade_to_class_included_instance2 = anonymous_module_cascade_to_class_included( :extend, Module1, Module2 )
|
101
|
-
anonymous_module_cascade_to_class_included_instance2.should_not == anonymous_module_cascade_to_class_included_instance
|
102
|
-
module AnotherModule
|
103
|
-
end
|
104
|
-
AnotherModule.extend( anonymous_module_cascade_to_class_included_instance2 )
|
105
|
-
AnotherModule.respond_to?( :included ).should == true
|
106
|
-
module YetAnotherModule
|
107
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::AnotherModule
|
108
|
-
eigenclass = class << self ; self ; end
|
109
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module1 ).should == false
|
110
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module2 ).should == false
|
111
|
-
end
|
112
|
-
module Cascade2
|
113
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::YetAnotherModule
|
114
|
-
eigenclass = class << self ; self ; end
|
115
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module1 ).should == false
|
116
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module2 ).should == false
|
117
|
-
end
|
118
|
-
class CascadeClass2
|
119
|
-
include ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Cascade2
|
120
|
-
eigenclass = class << self ; self ; end
|
121
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module1 ).should == true
|
122
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module2 ).should == true
|
123
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock02::Module2 ) ).should == true
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
#####################################################
|
129
|
-
# anonymous_module_cascade_to_class_extend_object #
|
130
|
-
#####################################################
|
131
|
-
|
132
|
-
it 'it can construct an anonymous module each time requested to extend object with modules' do
|
133
|
-
class ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03
|
134
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
135
|
-
module Module1
|
136
|
-
end
|
137
|
-
module Module2
|
138
|
-
end
|
139
|
-
anonymous_module_cascade_to_class_extend_object_instance = anonymous_module_cascade_to_class_extend_object( :include, Module1, Module2 )
|
140
|
-
anonymous_module_cascade_to_class_extend_object_instance.is_a?( Module ).should == true
|
141
|
-
anonymous_module_cascade_to_class_extend_object_instance.instance_methods.include?( :extend_object ).should == true
|
142
|
-
module SomeModule
|
143
|
-
end
|
144
|
-
SomeModule.extend( anonymous_module_cascade_to_class_extend_object_instance )
|
145
|
-
SomeModule.respond_to?( :extend_object ).should == true
|
146
|
-
module SomeOtherModule
|
147
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::SomeModule
|
148
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module1 ).should == false
|
149
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module2 ).should == false
|
150
|
-
end
|
151
|
-
module Cascade1
|
152
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::SomeOtherModule
|
153
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module1 ).should == false
|
154
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module2 ).should == false
|
155
|
-
end
|
156
|
-
class CascadeClass1
|
157
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Cascade1
|
158
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module1 ).should == true
|
159
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module2 ).should == true
|
160
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module2 ) ).should == true
|
161
|
-
end
|
162
|
-
anonymous_module_cascade_to_class_extend_object_instance2 = anonymous_module_cascade_to_class_extend_object( :extend, Module1, Module2 )
|
163
|
-
anonymous_module_cascade_to_class_extend_object_instance2.should_not == anonymous_module_cascade_to_class_extend_object_instance
|
164
|
-
module AnotherModule
|
165
|
-
end
|
166
|
-
AnotherModule.extend( anonymous_module_cascade_to_class_extend_object_instance2 )
|
167
|
-
AnotherModule.respond_to?( :extend_object ).should == true
|
168
|
-
module YetAnotherModule
|
169
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::AnotherModule
|
170
|
-
eigenclass = class << self ; self ; end
|
171
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module1 ).should == false
|
172
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module2 ).should == false
|
173
|
-
end
|
174
|
-
module Cascade2
|
175
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::YetAnotherModule
|
176
|
-
end
|
177
|
-
class CascadeClass2
|
178
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Cascade2
|
179
|
-
eigenclass = class << self ; self ; end
|
180
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module1 ).should == true
|
181
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module2 ).should == true
|
182
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock03::Module2 ) ).should == true
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
################################################
|
188
|
-
# anonymous_module_cascade_to_class_extended #
|
189
|
-
################################################
|
190
|
-
|
191
|
-
it 'it can construct an anonymous module each time requested to extend with modules' do
|
192
|
-
class ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04
|
193
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
194
|
-
module Module1
|
195
|
-
end
|
196
|
-
module Module2
|
197
|
-
end
|
198
|
-
anonymous_module_cascade_to_class_extended_instance = anonymous_module_cascade_to_class_extended( :include, Module1, Module2 )
|
199
|
-
anonymous_module_cascade_to_class_extended_instance.is_a?( Module ).should == true
|
200
|
-
anonymous_module_cascade_to_class_extended_instance.instance_methods.include?( :extended ).should == true
|
201
|
-
module SomeModule
|
202
|
-
end
|
203
|
-
SomeModule.extend( anonymous_module_cascade_to_class_extended_instance )
|
204
|
-
SomeModule.respond_to?( :extended ).should == true
|
205
|
-
module SomeOtherModule
|
206
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::SomeModule
|
207
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module1 ).should == false
|
208
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module2 ).should == false
|
209
|
-
end
|
210
|
-
module Cascade1
|
211
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::SomeOtherModule
|
212
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module1 ).should == false
|
213
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module2 ).should == false
|
214
|
-
end
|
215
|
-
class CascadeClass1
|
216
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Cascade1
|
217
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module1 ).should == true
|
218
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module2 ).should == true
|
219
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module2 ) ).should == true
|
220
|
-
end
|
221
|
-
anonymous_module_cascade_to_class_extended_instance2 = anonymous_module_cascade_to_class_extended( :extend, Module1, Module2 )
|
222
|
-
anonymous_module_cascade_to_class_extended_instance2.should_not == anonymous_module_cascade_to_class_extended_instance
|
223
|
-
module AnotherModule
|
224
|
-
end
|
225
|
-
AnotherModule.extend( anonymous_module_cascade_to_class_extended_instance2 )
|
226
|
-
AnotherModule.respond_to?( :extended ).should == true
|
227
|
-
module YetAnotherModule
|
228
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::AnotherModule
|
229
|
-
eigenclass = class << self ; self ; end
|
230
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module1 ).should == false
|
231
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module2 ).should == false
|
232
|
-
end
|
233
|
-
module Cascade2
|
234
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::YetAnotherModule
|
235
|
-
eigenclass = class << self ; self ; end
|
236
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module1 ).should == false
|
237
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module2 ).should == false
|
238
|
-
end
|
239
|
-
class CascadeClass2
|
240
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Cascade2
|
241
|
-
eigenclass = class << self ; self ; end
|
242
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module1 ).should == true
|
243
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module2 ).should == true
|
244
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToClass::PrivateMock04::Module2 ) ).should == true
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
end
|
@@ -1,266 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative '../../../../lib/module-cluster.rb'
|
3
|
-
|
4
|
-
describe ModuleCluster::Define::ModuleClusterCascadesToModule do
|
5
|
-
|
6
|
-
########################################################
|
7
|
-
# anonymous_module_cascade_to_module_append_features #
|
8
|
-
########################################################
|
9
|
-
|
10
|
-
it 'it can construct an anonymous module each time requested to append features with modules' do
|
11
|
-
class ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01
|
12
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
13
|
-
module Module1
|
14
|
-
end
|
15
|
-
module Module2
|
16
|
-
end
|
17
|
-
anonymous_module_cascade_to_module_append_features_instance = anonymous_module_cascade_to_module_append_features( :include, Module1, Module2 )
|
18
|
-
anonymous_module_cascade_to_module_append_features_instance.is_a?( Module ).should == true
|
19
|
-
anonymous_module_cascade_to_module_append_features_instance.instance_methods.include?( :append_features ).should == true
|
20
|
-
module SomeModule
|
21
|
-
end
|
22
|
-
SomeModule.extend( anonymous_module_cascade_to_module_append_features_instance )
|
23
|
-
SomeModule.respond_to?( :append_features ).should == true
|
24
|
-
module SomeOtherModule
|
25
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::SomeModule
|
26
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ).should == true
|
27
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ).should == true
|
28
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ) ).should == true
|
29
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::SomeModule ) ).should == true
|
30
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::SomeModule ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::SomeOtherModule ) ).should == true
|
31
|
-
end
|
32
|
-
module Cascade1
|
33
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::SomeOtherModule
|
34
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ).should == true
|
35
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ).should == true
|
36
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ) ).should == true
|
37
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::SomeModule ) ).should == true
|
38
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::SomeModule ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::SomeOtherModule ) ).should == true
|
39
|
-
end
|
40
|
-
class CascadeClass1
|
41
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Cascade1
|
42
|
-
# true because of ancestor chain
|
43
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ).should == true
|
44
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ).should == true
|
45
|
-
end
|
46
|
-
anonymous_module_cascade_to_module_append_features_instance2 = anonymous_module_cascade_to_module_append_features( :extend, Module1, Module2 )
|
47
|
-
anonymous_module_cascade_to_module_append_features_instance2.should_not == anonymous_module_cascade_to_module_append_features_instance
|
48
|
-
module AnotherModule
|
49
|
-
end
|
50
|
-
AnotherModule.extend( anonymous_module_cascade_to_module_append_features_instance2 )
|
51
|
-
AnotherModule.respond_to?( :append_features ).should == true
|
52
|
-
module YetAnotherModule
|
53
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::AnotherModule
|
54
|
-
eigenclass = class << self ; self ; end
|
55
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ).should == true
|
56
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ).should == true
|
57
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ) ).should == true
|
58
|
-
end
|
59
|
-
module Cascade2
|
60
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::YetAnotherModule
|
61
|
-
eigenclass = class << self ; self ; end
|
62
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ).should == true
|
63
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ).should == true
|
64
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ) ).should == true
|
65
|
-
end
|
66
|
-
class CascadeClass2
|
67
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Cascade2
|
68
|
-
eigenclass = class << self ; self ; end
|
69
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module1 ).should == false
|
70
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock01::Module2 ).should == false
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
#################################################
|
76
|
-
# anonymous_module_cascade_to_module_included #
|
77
|
-
#################################################
|
78
|
-
|
79
|
-
it 'it can construct an anonymous module each time requested to include with modules' do
|
80
|
-
class ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02
|
81
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
82
|
-
module Module1
|
83
|
-
end
|
84
|
-
module Module2
|
85
|
-
end
|
86
|
-
anonymous_module_cascade_to_module_included_instance = anonymous_module_cascade_to_module_included( :include, Module1, Module2 )
|
87
|
-
anonymous_module_cascade_to_module_included_instance.is_a?( Module ).should == true
|
88
|
-
anonymous_module_cascade_to_module_included_instance.instance_methods.include?( :included ).should == true
|
89
|
-
module SomeModule
|
90
|
-
end
|
91
|
-
SomeModule.extend( anonymous_module_cascade_to_module_included_instance )
|
92
|
-
SomeModule.respond_to?( :included ).should == true
|
93
|
-
module SomeOtherModule
|
94
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::SomeModule
|
95
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module1 ).should == true
|
96
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module2 ).should == true
|
97
|
-
end
|
98
|
-
module Cascade1
|
99
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::SomeOtherModule
|
100
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module1 ).should == true
|
101
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module2 ).should == true
|
102
|
-
end
|
103
|
-
class CascadeClass1
|
104
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Cascade1
|
105
|
-
# true because of ancestor chain
|
106
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module1 ).should == true
|
107
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module2 ).should == true
|
108
|
-
end
|
109
|
-
anonymous_module_cascade_to_module_included_instance2 = anonymous_module_cascade_to_module_included( :extend, Module1, Module2 )
|
110
|
-
anonymous_module_cascade_to_module_included_instance2.should_not == anonymous_module_cascade_to_module_included_instance
|
111
|
-
module AnotherModule
|
112
|
-
end
|
113
|
-
AnotherModule.extend( anonymous_module_cascade_to_module_included_instance2 )
|
114
|
-
AnotherModule.respond_to?( :included ).should == true
|
115
|
-
module YetAnotherModule
|
116
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::AnotherModule
|
117
|
-
eigenclass = class << self ; self ; end
|
118
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module1 ).should == true
|
119
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module2 ).should == true
|
120
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module2 ) ).should == true
|
121
|
-
end
|
122
|
-
module Cascade2
|
123
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::YetAnotherModule
|
124
|
-
eigenclass = class << self ; self ; end
|
125
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module1 ).should == true
|
126
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module2 ).should == true
|
127
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module2 ) ).should == true
|
128
|
-
end
|
129
|
-
class CascadeClass2
|
130
|
-
include ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Cascade2
|
131
|
-
eigenclass = class << self ; self ; end
|
132
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module1 ).should == false
|
133
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock02::Module2 ).should == false
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
######################################################
|
139
|
-
# anonymous_module_cascade_to_module_extend_object #
|
140
|
-
######################################################
|
141
|
-
|
142
|
-
it 'it can construct an anonymous module each time requested to extend object with modules' do
|
143
|
-
class ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03
|
144
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
145
|
-
module Module1
|
146
|
-
end
|
147
|
-
module Module2
|
148
|
-
end
|
149
|
-
anonymous_module_cascade_to_module_extend_object_instance = anonymous_module_cascade_to_module_extend_object( :include, Module1, Module2 )
|
150
|
-
anonymous_module_cascade_to_module_extend_object_instance.is_a?( Module ).should == true
|
151
|
-
anonymous_module_cascade_to_module_extend_object_instance.instance_methods.include?( :extend_object ).should == true
|
152
|
-
module SomeModule
|
153
|
-
end
|
154
|
-
SomeModule.extend( anonymous_module_cascade_to_module_extend_object_instance )
|
155
|
-
SomeModule.respond_to?( :extend_object ).should == true
|
156
|
-
module SomeOtherModule
|
157
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::SomeModule
|
158
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ).should == true
|
159
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ).should == true
|
160
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ) ).should == true
|
161
|
-
end
|
162
|
-
module Cascade1
|
163
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::SomeOtherModule
|
164
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ).should == true
|
165
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ).should == true
|
166
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ) ).should == true
|
167
|
-
end
|
168
|
-
class CascadeClass1
|
169
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Cascade1
|
170
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ).should == false
|
171
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ).should == false
|
172
|
-
end
|
173
|
-
anonymous_module_cascade_to_module_extend_object_instance2 = anonymous_module_cascade_to_module_extend_object( :extend, Module1, Module2 )
|
174
|
-
anonymous_module_cascade_to_module_extend_object_instance2.should_not == anonymous_module_cascade_to_module_extend_object_instance
|
175
|
-
module AnotherModule
|
176
|
-
end
|
177
|
-
AnotherModule.extend( anonymous_module_cascade_to_module_extend_object_instance2 )
|
178
|
-
AnotherModule.respond_to?( :extend_object ).should == true
|
179
|
-
module YetAnotherModule
|
180
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::AnotherModule
|
181
|
-
eigenclass = class << self ; self ; end
|
182
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ).should == true
|
183
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ).should == true
|
184
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ) ).should == true
|
185
|
-
end
|
186
|
-
module Cascade2
|
187
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::YetAnotherModule
|
188
|
-
eigenclass = class << self ; self ; end
|
189
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ).should == true
|
190
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ).should == true
|
191
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ) ).should == true
|
192
|
-
end
|
193
|
-
class CascadeClass2
|
194
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Cascade2
|
195
|
-
eigenclass = class << self ; self ; end
|
196
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module1 ).should == false
|
197
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock03::Module2 ).should == false
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
#################################################
|
203
|
-
# anonymous_module_cascade_to_module_extended #
|
204
|
-
#################################################
|
205
|
-
|
206
|
-
it 'it can construct an anonymous module each time requested to extend with modules' do
|
207
|
-
class ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04
|
208
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
209
|
-
module Module1
|
210
|
-
end
|
211
|
-
module Module2
|
212
|
-
end
|
213
|
-
anonymous_module_cascade_to_module_extended_instance = anonymous_module_cascade_to_module_extended( :include, Module1, Module2 )
|
214
|
-
anonymous_module_cascade_to_module_extended_instance.is_a?( Module ).should == true
|
215
|
-
anonymous_module_cascade_to_module_extended_instance.instance_methods.include?( :extended ).should == true
|
216
|
-
module SomeModule
|
217
|
-
end
|
218
|
-
SomeModule.extend( anonymous_module_cascade_to_module_extended_instance )
|
219
|
-
SomeModule.respond_to?( :extended ).should == true
|
220
|
-
module SomeOtherModule
|
221
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::SomeModule
|
222
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ).should == true
|
223
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ).should == true
|
224
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ) ).should == true
|
225
|
-
end
|
226
|
-
module Cascade1
|
227
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::SomeOtherModule
|
228
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ).should == true
|
229
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ).should == true
|
230
|
-
( ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ) ).should == true
|
231
|
-
end
|
232
|
-
class CascadeClass1
|
233
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Cascade1
|
234
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ).should == false
|
235
|
-
ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ).should == false
|
236
|
-
end
|
237
|
-
anonymous_module_cascade_to_module_extended_instance2 = anonymous_module_cascade_to_module_extended( :extend, Module1, Module2 )
|
238
|
-
anonymous_module_cascade_to_module_extended_instance2.should_not == anonymous_module_cascade_to_module_extended_instance
|
239
|
-
module AnotherModule
|
240
|
-
end
|
241
|
-
AnotherModule.extend( anonymous_module_cascade_to_module_extended_instance2 )
|
242
|
-
AnotherModule.respond_to?( :extended ).should == true
|
243
|
-
module YetAnotherModule
|
244
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::AnotherModule
|
245
|
-
eigenclass = class << self ; self ; end
|
246
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ).should == true
|
247
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ).should == true
|
248
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ) ).should == true
|
249
|
-
end
|
250
|
-
module Cascade2
|
251
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::YetAnotherModule
|
252
|
-
eigenclass = class << self ; self ; end
|
253
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ).should == true
|
254
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ).should == true
|
255
|
-
( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ) ).should == true
|
256
|
-
end
|
257
|
-
class CascadeClass2
|
258
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Cascade2
|
259
|
-
eigenclass = class << self ; self ; end
|
260
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module1 ).should == false
|
261
|
-
eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascadesToModule::PrivateMock04::Module2 ).should == false
|
262
|
-
end
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
end
|