module-cluster 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +66 -29
- data/README.rdoc +66 -29
- data/lib/module-cluster.rb +18 -0
- data/lib/module-cluster/ModuleCluster.rb +2 -7
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +4 -4
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +11 -8
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +19 -12
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +19 -12
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +19 -12
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +3 -2
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +11 -8
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +19 -12
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +39 -46
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +34 -33
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +31 -42
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +53 -62
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +49 -60
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +49 -60
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +3 -4
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +39 -46
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +55 -54
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +34 -33
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +4 -4
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +64 -46
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +7 -5
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +3 -3
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +2 -2
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +2 -2
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +4 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +45 -13
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +36 -10
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +47 -15
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +38 -12
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +29 -1
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +8 -3
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +10 -10
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +18 -18
- data/spec/ModuleCluster/Define/Cluster_spec.rb +18 -18
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +2 -2
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +10 -10
- data/spec/ModuleCluster_spec.rb +5 -5
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +110 -2
- metadata +2 -2
@@ -34,7 +34,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
34
34
|
end
|
35
35
|
module Module2
|
36
36
|
end
|
37
|
-
module_include_or_extend_or_instance_extend_also_includes_or_extends( Module1, Module2 )
|
37
|
+
module_include_or_extend_or_instance_extend_also_includes_or_extends( Module1, Module2 ).name = :some_name
|
38
38
|
respond_to?( :included ).should == true
|
39
39
|
respond_to?( :extended ).should == true
|
40
40
|
module ModuleProof
|
@@ -89,7 +89,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
89
89
|
end
|
90
90
|
module Module2
|
91
91
|
end
|
92
|
-
module_include_or_extend_or_instance_extend_also_extends( Module1, Module2 )
|
92
|
+
module_include_or_extend_or_instance_extend_also_extends( Module1, Module2 ).name = :some_name
|
93
93
|
respond_to?( :included ).should == true
|
94
94
|
respond_to?( :extended ).should == true
|
95
95
|
module ModuleProof
|
@@ -144,7 +144,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
144
144
|
end
|
145
145
|
module Module2
|
146
146
|
end
|
147
|
-
module_include_or_instance_extend_also_includes_or_extends( Module1, Module2 )
|
147
|
+
module_include_or_instance_extend_also_includes_or_extends( Module1, Module2 ).name = :some_name
|
148
148
|
respond_to?( :included ).should == true
|
149
149
|
respond_to?( :extended ).should == true
|
150
150
|
module ModuleProof
|
@@ -199,7 +199,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
199
199
|
end
|
200
200
|
module Module2
|
201
201
|
end
|
202
|
-
module_include_or_instance_extend_also_extends( Module1, Module2 )
|
202
|
+
module_include_or_instance_extend_also_extends( Module1, Module2 ).name = :some_name
|
203
203
|
respond_to?( :included ).should == true
|
204
204
|
respond_to?( :extended ).should == true
|
205
205
|
module ModuleProof
|
@@ -254,7 +254,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
254
254
|
end
|
255
255
|
module Module2
|
256
256
|
end
|
257
|
-
module_or_instance_extend_also_extends( Module1, Module2 )
|
257
|
+
module_or_instance_extend_also_extends( Module1, Module2 ).name = :some_name
|
258
258
|
respond_to?( :included ).should == true
|
259
259
|
respond_to?( :extended ).should == true
|
260
260
|
module ModuleProof
|
@@ -309,7 +309,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
309
309
|
end
|
310
310
|
module Module2
|
311
311
|
end
|
312
|
-
module_include_or_extend_or_instance_extend_prepends_includes_or_extends( Module1, Module2 )
|
312
|
+
module_include_or_extend_or_instance_extend_prepends_includes_or_extends( Module1, Module2 ).name = :some_name
|
313
313
|
respond_to?( :included ).should == true
|
314
314
|
respond_to?( :extended ).should == true
|
315
315
|
module ModuleProof
|
@@ -364,7 +364,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
364
364
|
end
|
365
365
|
module Module2
|
366
366
|
end
|
367
|
-
module_include_or_instance_extend_prepends_includes_or_extends( Module1, Module2 )
|
367
|
+
module_include_or_instance_extend_prepends_includes_or_extends( Module1, Module2 ).name = :some_name
|
368
368
|
respond_to?( :included ).should == true
|
369
369
|
respond_to?( :extended ).should == true
|
370
370
|
module ModuleProof
|
@@ -419,7 +419,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
419
419
|
end
|
420
420
|
module Module2
|
421
421
|
end
|
422
|
-
module_include_or_extend_or_instance_extend_prepends_extends( Module1, Module2 )
|
422
|
+
module_include_or_extend_or_instance_extend_prepends_extends( Module1, Module2 ).name = :some_name
|
423
423
|
respond_to?( :included ).should == true
|
424
424
|
respond_to?( :extended ).should == true
|
425
425
|
module ModuleProof
|
@@ -474,7 +474,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
474
474
|
end
|
475
475
|
module Module2
|
476
476
|
end
|
477
|
-
module_include_or_instance_extend_prepends_extends( Module1, Module2 )
|
477
|
+
module_include_or_instance_extend_prepends_extends( Module1, Module2 ).name = :some_name
|
478
478
|
respond_to?( :included ).should == true
|
479
479
|
respond_to?( :extended ).should == true
|
480
480
|
module ModuleProof
|
@@ -529,7 +529,7 @@ describe ModuleCluster::Define::ModuleOrInstanceCluster do
|
|
529
529
|
end
|
530
530
|
module Module2
|
531
531
|
end
|
532
|
-
module_or_instance_extend_prepends_extends( Module1, Module2 )
|
532
|
+
module_or_instance_extend_prepends_extends( Module1, Module2 ).name = :some_name
|
533
533
|
respond_to?( :included ).should == true
|
534
534
|
respond_to?( :extended ).should == true
|
535
535
|
module ModuleProof
|
data/spec/ModuleCluster_spec.rb
CHANGED
@@ -4,11 +4,11 @@ describe ModuleCluster do
|
|
4
4
|
|
5
5
|
it 'clusters other modules' do
|
6
6
|
module ModuleCluster
|
7
|
-
is_a?(
|
8
|
-
is_a?(
|
9
|
-
is_a?(
|
10
|
-
is_a?(
|
11
|
-
is_a?(
|
7
|
+
is_a?( Define::Cluster )
|
8
|
+
is_a?( Define::ClusterCascades )
|
9
|
+
is_a?( Define::ClusterCascadesToClass )
|
10
|
+
is_a?( Define::ClusterCascadesToModule )
|
11
|
+
is_a?( Define::Deprecated )
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -53,6 +53,90 @@ describe ModuleCluster::CascadeFeatures::PerformCascades do
|
|
53
53
|
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
54
54
|
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
55
55
|
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
56
|
+
module_class_instance_or_all = :module_class_or_instance
|
57
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
58
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
59
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
60
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
61
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
62
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
63
|
+
module_class_instance_or_all = :module_class_and_instance
|
64
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
65
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
66
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
67
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
68
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
69
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
70
|
+
module_class_instance_or_all = :module_class_instance
|
71
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
72
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
73
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
74
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
75
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
76
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
77
|
+
module_class_instance_or_all = :module_or_class
|
78
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
79
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
80
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
81
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
82
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
83
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
84
|
+
module_class_instance_or_all = :module_and_class
|
85
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
86
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
87
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
88
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
89
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
90
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
91
|
+
module_class_instance_or_all = :module_class
|
92
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
93
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
94
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
95
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
96
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
97
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
98
|
+
module_class_instance_or_all = :module_or_instance
|
99
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
100
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
101
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
102
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
103
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
104
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
105
|
+
module_class_instance_or_all = :module_and_instance
|
106
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
107
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
108
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
109
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
110
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
111
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
112
|
+
module_class_instance_or_all = :module_instance
|
113
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
114
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
115
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
116
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
117
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
118
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
119
|
+
module_class_instance_or_all = :class_or_instance
|
120
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
121
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
122
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
123
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
124
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
125
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
126
|
+
module_class_instance_or_all = :class_and_instance
|
127
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
128
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
129
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
130
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
131
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
132
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
133
|
+
module_class_instance_or_all = :class_instance
|
134
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
135
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
|
136
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
|
137
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
138
|
+
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
|
139
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
56
140
|
module_class_instance_or_all = :module
|
57
141
|
into_instance = ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
|
58
142
|
ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
|
@@ -224,7 +308,7 @@ describe ModuleCluster::CascadeFeatures::PerformCascades do
|
|
224
308
|
end
|
225
309
|
|
226
310
|
######################
|
227
|
-
#
|
311
|
+
# perform_cascades #
|
228
312
|
######################
|
229
313
|
|
230
314
|
it 'can perform cascade of specified modules into instance' do
|
@@ -237,6 +321,15 @@ describe ModuleCluster::CascadeFeatures::PerformCascades do
|
|
237
321
|
def self.should_cascade?( hooked_instance )
|
238
322
|
return true
|
239
323
|
end
|
324
|
+
def self.hooks_suspended?( action )
|
325
|
+
return @hooks_suspended ||= false
|
326
|
+
end
|
327
|
+
def self.suspend_hooks
|
328
|
+
@hooks_suspended = true
|
329
|
+
end
|
330
|
+
def self.unsuspend_hooks
|
331
|
+
@hooks_suspended = false
|
332
|
+
end
|
240
333
|
def declaration_method( modules )
|
241
334
|
@declaration_method_called = true
|
242
335
|
end
|
@@ -264,7 +357,21 @@ describe ModuleCluster::CascadeFeatures::PerformCascades do
|
|
264
357
|
set_two = ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :extend, [ ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06B ] )
|
265
358
|
set_three = ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :include_and_extend, [ ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ] )
|
266
359
|
set_stack = [ set_one, set_two, set_three ]
|
267
|
-
|
360
|
+
|
361
|
+
# test that suspending works - mocked for true/false
|
362
|
+
module_self.suspend_hooks
|
363
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock06.perform_cascades( module_self, :include, hooked_instance, set_stack )
|
364
|
+
hooked_instance.ancestors.include?( ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06A ).should == false
|
365
|
+
hooked_instance.ancestors.include?( ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ).should == false
|
366
|
+
eigenclass = class << hooked_instance ; self ; end
|
367
|
+
eigenclass.ancestors.include?( ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06B ).should == false
|
368
|
+
eigenclass.ancestors.include?( ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ).should == false
|
369
|
+
# also our dependency module should be extended
|
370
|
+
eigenclass.ancestors.include?( module_self ).should == false
|
371
|
+
module_self.unsuspend_hooks
|
372
|
+
|
373
|
+
|
374
|
+
ModuleCluster::CascadeFeatures::PerformCascades::Mock06.perform_cascades( module_self, :include, hooked_instance, set_stack )
|
268
375
|
hooked_instance.ancestors.include?( ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06A ).should == true
|
269
376
|
hooked_instance.ancestors.include?( ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ).should == true
|
270
377
|
eigenclass = class << hooked_instance ; self ; end
|
@@ -273,6 +380,7 @@ describe ModuleCluster::CascadeFeatures::PerformCascades do
|
|
273
380
|
# also our dependency module should be extended
|
274
381
|
eigenclass.ancestors.include?( module_self ).should == true
|
275
382
|
hooked_instance.called_declaration_method.should == true
|
383
|
+
|
276
384
|
end
|
277
385
|
|
278
386
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: module-cluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.4.
|
5
|
+
version: 1.4.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Asher
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-01-08 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: "Provides methods for clustering modules so that when the main module is included other modules are also included or extended, either before or after the main module. There are currently three variants: cluster, cascade, cascade to class. Cluster causes the next module to be affected. Cascade causes all subsequent modules to be affected. Cascade to class causes the first including/extending class to be affected, but not any modules prior to it (although the effects will cascade through those unaffected modules)."
|