module-cluster 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/README.md +4 -4
  2. data/README.rdoc +4 -4
  3. data/lib/module-cluster.rb +19 -10
  4. data/lib/module-cluster/ModuleCluster.rb +1 -1
  5. data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +3 -3
  6. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +4 -4
  7. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +4 -4
  8. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +4 -4
  9. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +29 -0
  10. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +22 -0
  11. data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +3 -3
  12. data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +3 -3
  13. data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +4 -4
  14. data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +22 -0
  15. data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +32 -5
  16. data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +3 -3
  17. data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +3 -3
  18. data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +3 -3
  19. data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +3 -3
  20. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +3 -3
  21. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +3 -3
  22. data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +3 -3
  23. data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +3 -3
  24. data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +3 -3
  25. data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +3 -3
  26. data/lib/module-cluster/ModuleCluster/Define/Status.rb +4 -4
  27. data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +1 -1
  28. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +1 -1
  29. data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +1 -1
  30. data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade/Subclass.rb +55 -8
  31. data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +36 -36
  32. data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +36 -36
  33. data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +55 -0
  34. data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +36 -36
  35. data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +54 -0
  36. data/spec/ModuleCluster/Define/Block/Class_spec.rb +36 -36
  37. data/spec/ModuleCluster/Define/Block/Instance_spec.rb +12 -12
  38. data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +53 -0
  39. data/spec/ModuleCluster/Define/Block/Module_spec.rb +36 -36
  40. data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +39 -9
  41. data/spec/ModuleCluster/Define/ClassCluster_spec.rb +71 -71
  42. data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +60 -60
  43. data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +72 -72
  44. data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +72 -72
  45. data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +68 -68
  46. data/spec/ModuleCluster/Define/Cluster_spec.rb +71 -71
  47. data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +8 -8
  48. data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +71 -71
  49. data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +71 -71
  50. data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +60 -60
  51. data/spec/ModuleCluster/Suspend/Hooks_spec.rb +14 -14
  52. data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +14 -14
  53. data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +6 -6
  54. data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +8 -8
  55. metadata +33 -29
@@ -1,10 +1,10 @@
1
1
 
2
2
  module ModuleCluster::Define::ClusterCascadesToModule
3
3
 
4
- include ModuleCluster::CascadeFeatures::ClusterStack
5
- include ModuleCluster::Suspend::WithoutHooks
4
+ include ::ModuleCluster::CascadeFeatures::ClusterStack
5
+ include ::ModuleCluster::Suspend::WithoutHooks
6
6
 
7
- extend ModuleCluster::ExtendForCascade
7
+ extend ::ModuleCluster::ExtendForCascade
8
8
 
9
9
  ####################################
10
10
  # self.should_include_or_extend? #
@@ -1,10 +1,10 @@
1
1
 
2
2
  module ModuleCluster::Define::InstanceCluster
3
3
 
4
- include ModuleCluster::CascadeFeatures::ClusterStack
5
- include ModuleCluster::Suspend::WithoutHooks
4
+ include ::ModuleCluster::CascadeFeatures::ClusterStack
5
+ include ::ModuleCluster::Suspend::WithoutHooks
6
6
 
7
- extend ModuleCluster::ExtendForCascade
7
+ extend ::ModuleCluster::ExtendForCascade
8
8
 
9
9
  ####################################
10
10
  # self.should_include_or_extend? #
@@ -1,10 +1,10 @@
1
1
 
2
2
  module ModuleCluster::Define::ModuleCluster
3
3
 
4
- include ModuleCluster::CascadeFeatures::ClusterStack
5
- include ModuleCluster::Suspend::WithoutHooks
4
+ include ::ModuleCluster::CascadeFeatures::ClusterStack
5
+ include ::ModuleCluster::Suspend::WithoutHooks
6
6
 
7
- extend ModuleCluster::ExtendForCascade
7
+ extend ::ModuleCluster::ExtendForCascade
8
8
 
9
9
  ####################################
10
10
  # self.should_include_or_extend? #
@@ -1,10 +1,10 @@
1
1
 
2
2
  module ModuleCluster::Define::ModuleOrClassCluster
3
3
 
4
- include ModuleCluster::CascadeFeatures::ClusterStack
5
- include ModuleCluster::Suspend::WithoutHooks
4
+ include ::ModuleCluster::CascadeFeatures::ClusterStack
5
+ include ::ModuleCluster::Suspend::WithoutHooks
6
6
 
7
- extend ModuleCluster::ExtendForCascade
7
+ extend ::ModuleCluster::ExtendForCascade
8
8
 
9
9
  ####################################
10
10
  # self.should_include_or_extend? #
@@ -1,10 +1,10 @@
1
1
 
2
2
  module ModuleCluster::Define::ModuleOrInstanceCluster
3
3
 
4
- include ModuleCluster::CascadeFeatures::ClusterStack
5
- include ModuleCluster::Suspend::WithoutHooks
4
+ include ::ModuleCluster::CascadeFeatures::ClusterStack
5
+ include ::ModuleCluster::Suspend::WithoutHooks
6
6
 
7
- extend ModuleCluster::ExtendForCascade
7
+ extend ::ModuleCluster::ExtendForCascade
8
8
 
9
9
  ####################################
10
10
  # self.should_include_or_extend? #
@@ -17,17 +17,17 @@ module ModuleCluster::Define::Status
17
17
  return cluster_stack.extend_hooks
18
18
  end
19
19
 
20
- ##############################
20
+ ###########################
21
21
  # prepend_include_hooks #
22
- ##############################
22
+ ###########################
23
23
 
24
24
  def prepend_include_hooks
25
25
  return cluster_stack.prepend_include_hooks
26
26
  end
27
27
 
28
- #############################
28
+ ##########################
29
29
  # prepend_extend_hooks #
30
- #############################
30
+ ##########################
31
31
 
32
32
  def prepend_extend_hooks
33
33
  return cluster_stack.prepend_extend_hooks
@@ -1,7 +1,7 @@
1
1
 
2
2
  module ModuleCluster::Suspend::WithoutHooks
3
3
 
4
- include ModuleCluster::Suspend::Hooks
4
+ include ::ModuleCluster::Suspend::Hooks
5
5
 
6
6
  #######################
7
7
  # without_any_hooks #
@@ -1,7 +1,7 @@
1
1
 
2
2
  module ModuleCluster::CascadeFeatures
3
3
 
4
- extend ModuleCluster::CascadeFeatures::PerformCascades
4
+ extend ::ModuleCluster::CascadeFeatures::PerformCascades
5
5
 
6
6
  #####################
7
7
  # append_features #
@@ -11,7 +11,7 @@ module ModuleCluster::ExtendForCascade
11
11
  # when a module-cluster definition module is used to extend a module,
12
12
  # define self#extended, self#included, self#append_features, self#extend_object in
13
13
  # module_cluster_module ( module extended with module-cluster definition module )
14
- extend ModuleCluster::CascadeFeatures
14
+ extend ::ModuleCluster::CascadeFeatures
15
15
  # classes and instances can't cascade through include/extend, so no reason to define
16
16
  # unless we have a module
17
17
  end if module_cluster_configuration_instance.is_a?( Module ) and ! module_cluster_configuration_instance.is_a?( Class )
@@ -6,16 +6,63 @@ module ModuleCluster::ExtendForCascade::Subclass
6
6
  ##############
7
7
 
8
8
  def extended( module_cluster_configuration_class_instance )
9
- unless module_cluster_configuration_class_instance.is_a?( Class )
10
- raise ArgumentError, 'Module-cluster blocks cannot be defined for subclassing on non-class objects.'
11
- end
9
+
12
10
  super
13
- module_cluster_configuration_class_instance.module_eval do
14
- # when a module-cluster definition module is used to extend a module,
15
- # define self#inherited module_cluster_configuration_class_instance
16
- # (class extended with module-cluster definition module)
17
- extend ModuleCluster::CascadeFeatures::Subclass
11
+
12
+ if module_cluster_configuration_class_instance.is_a?( Class )
13
+
14
+ module_cluster_configuration_class_instance.module_eval do
15
+ # when a module-cluster definition module is used to extend a module,
16
+ # define self#inherited module_cluster_configuration_class_instance
17
+ # (class extended with module-cluster definition module)
18
+ extend ::ModuleCluster::CascadeFeatures::Subclass
19
+ end
20
+
21
+ elsif module_cluster_configuration_class_instance.is_a?( Module )
22
+
23
+ # we need to create an include hook in the module so that when the class includes it,
24
+ # it gets the subclass definition
25
+ module_cluster_configuration_class_instance.module_eval do
26
+ # when a module is enabled for subclass we need to cascade subclassing
27
+ extend ::ModuleCluster::ExtendForCascade::Subclass
28
+ end
29
+
18
30
  end
31
+
19
32
  end
20
33
 
34
+ ##############
35
+ # included #
36
+ ##############
37
+
38
+ def included( module_cluster_configuration_class_instance )
39
+
40
+ super
41
+
42
+ existing_inherited_hooks = cluster_stack.inherited_hooks
43
+
44
+ if module_cluster_configuration_class_instance.is_a?( Class )
45
+
46
+ module_cluster_configuration_class_instance.module_eval do
47
+ # when a module-cluster definition module is used to extend a module,
48
+ # define self#inherited module_cluster_configuration_class_instance
49
+ # (class extended with module-cluster definition module)
50
+ extend ::ModuleCluster::Define::Block::Subclass
51
+ cluster_stack.inherited_hooks.concat( existing_inherited_hooks )
52
+ end
53
+
54
+ elsif module_cluster_configuration_class_instance.is_a?( Module )
55
+
56
+ # we need to create an include hook in the module so that when the class includes it,
57
+ # it gets the subclass definition
58
+ module_cluster_configuration_class_instance.module_eval do
59
+ # when a module is enabled for subclass we need to cascade subclassing
60
+ extend ::ModuleCluster::Define::Block::Subclass
61
+ cluster_stack.inherited_hooks.concat( existing_inherited_hooks )
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+
21
68
  end
@@ -9,7 +9,7 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
9
9
 
10
10
  it 'can run a block on class or instance extend' do
11
11
  module ModuleCluster::Define::Block::ClassOrInstance::Mock01
12
- extend ModuleCluster::Define::Block::ClassOrInstance
12
+ extend ::ModuleCluster::Define::Block::ClassOrInstance
13
13
  block_ran = false
14
14
  class_or_instance_extend do
15
15
  block_ran = true
@@ -17,24 +17,24 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
17
17
  end
18
18
  respond_to?( :extended ).should == true
19
19
  module ModuleProof
20
- include ModuleCluster::Define::Block::ClassOrInstance::Mock01
20
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
21
21
  end
22
22
  block_ran.should == false
23
23
  module ModuleProof2
24
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock01
24
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
25
25
  end
26
26
  block_ran.should == false
27
27
  class ClassProof
28
- include ModuleCluster::Define::Block::ClassOrInstance::Mock01
28
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
29
29
  end
30
30
  block_ran.should == false
31
31
  class ClassProof2
32
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock01
32
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
33
33
  end
34
34
  block_ran.should == true
35
35
  block_ran = false
36
36
  Object.new.instance_eval do
37
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock01
37
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
38
38
  end
39
39
  block_ran.should == true
40
40
  end
@@ -46,7 +46,7 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
46
46
 
47
47
  it 'can run a block on class include or instance extend' do
48
48
  module ModuleCluster::Define::Block::ClassOrInstance::Mock02
49
- extend ModuleCluster::Define::Block::ClassOrInstance
49
+ extend ::ModuleCluster::Define::Block::ClassOrInstance
50
50
  block_ran = false
51
51
  class_include_or_instance_extend do
52
52
  block_ran = true
@@ -54,24 +54,24 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
54
54
  end
55
55
  respond_to?( :extended ).should == true
56
56
  module ModuleProof
57
- include ModuleCluster::Define::Block::ClassOrInstance::Mock02
57
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
58
58
  end
59
59
  block_ran.should == false
60
60
  module ModuleProof2
61
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock02
61
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
62
62
  end
63
63
  block_ran.should == false
64
64
  class ClassProof
65
- include ModuleCluster::Define::Block::ClassOrInstance::Mock02
65
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
66
66
  end
67
67
  block_ran.should == true
68
68
  block_ran = false
69
69
  class ClassProof2
70
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock02
70
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
71
71
  end
72
72
  block_ran.should == false
73
73
  Object.new.instance_eval do
74
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock02
74
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
75
75
  end
76
76
  block_ran.should == true
77
77
  end
@@ -83,7 +83,7 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
83
83
 
84
84
  it 'can run a block on class include or extend or instance extend' do
85
85
  module ModuleCluster::Define::Block::ClassOrInstance::Mock03
86
- extend ModuleCluster::Define::Block::ClassOrInstance
86
+ extend ::ModuleCluster::Define::Block::ClassOrInstance
87
87
  block_ran = false
88
88
  class_include_or_extend_or_instance_extend do
89
89
  block_ran = true
@@ -91,25 +91,25 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
91
91
  end
92
92
  respond_to?( :extended ).should == true
93
93
  module ModuleProof
94
- include ModuleCluster::Define::Block::ClassOrInstance::Mock03
94
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
95
95
  end
96
96
  block_ran.should == false
97
97
  module ModuleProof2
98
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock03
98
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
99
99
  end
100
100
  block_ran.should == false
101
101
  class ClassProof
102
- include ModuleCluster::Define::Block::ClassOrInstance::Mock03
102
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
103
103
  end
104
104
  block_ran.should == true
105
105
  block_ran = false
106
106
  class ClassProof2
107
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock03
107
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
108
108
  end
109
109
  block_ran.should == true
110
110
  block_ran = false
111
111
  Object.new.instance_eval do
112
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock03
112
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
113
113
  end
114
114
  block_ran.should == true
115
115
  end
@@ -121,7 +121,7 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
121
121
 
122
122
  it 'can run a block before class or instance extend' do
123
123
  module ModuleCluster::Define::Block::ClassOrInstance::Mock04
124
- extend ModuleCluster::Define::Block::ClassOrInstance
124
+ extend ::ModuleCluster::Define::Block::ClassOrInstance
125
125
  block_ran = false
126
126
  class_or_instance_extend do
127
127
  block_ran = true
@@ -129,24 +129,24 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
129
129
  end
130
130
  respond_to?( :extended ).should == true
131
131
  module ModuleProof
132
- include ModuleCluster::Define::Block::ClassOrInstance::Mock04
132
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
133
133
  end
134
134
  block_ran.should == false
135
135
  module ModuleProof2
136
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock04
136
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
137
137
  end
138
138
  block_ran.should == false
139
139
  class ClassProof
140
- include ModuleCluster::Define::Block::ClassOrInstance::Mock04
140
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
141
141
  end
142
142
  block_ran.should == false
143
143
  class ClassProof2
144
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock04
144
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
145
145
  end
146
146
  block_ran.should == true
147
147
  block_ran = false
148
148
  Object.new.instance_eval do
149
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock04
149
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
150
150
  end
151
151
  block_ran.should == true
152
152
  end
@@ -158,7 +158,7 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
158
158
 
159
159
  it 'can run a block before class include or instance extend' do
160
160
  module ModuleCluster::Define::Block::ClassOrInstance::Mock05
161
- extend ModuleCluster::Define::Block::ClassOrInstance
161
+ extend ::ModuleCluster::Define::Block::ClassOrInstance
162
162
  block_ran = false
163
163
  class_include_or_instance_extend do
164
164
  block_ran = true
@@ -166,24 +166,24 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
166
166
  end
167
167
  respond_to?( :extended ).should == true
168
168
  module ModuleProof
169
- include ModuleCluster::Define::Block::ClassOrInstance::Mock05
169
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
170
170
  end
171
171
  block_ran.should == false
172
172
  module ModuleProof2
173
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock05
173
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
174
174
  end
175
175
  block_ran.should == false
176
176
  class ClassProof
177
- include ModuleCluster::Define::Block::ClassOrInstance::Mock05
177
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
178
178
  end
179
179
  block_ran.should == true
180
180
  block_ran = false
181
181
  class ClassProof2
182
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock05
182
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
183
183
  end
184
184
  block_ran.should == false
185
185
  Object.new.instance_eval do
186
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock05
186
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
187
187
  end
188
188
  block_ran.should == true
189
189
  end
@@ -195,7 +195,7 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
195
195
 
196
196
  it 'can run a block before class include or extend or instance extend' do
197
197
  module ModuleCluster::Define::Block::ClassOrInstance::Mock06
198
- extend ModuleCluster::Define::Block::ClassOrInstance
198
+ extend ::ModuleCluster::Define::Block::ClassOrInstance
199
199
  block_ran = false
200
200
  class_include_or_extend_or_instance_extend do
201
201
  block_ran = true
@@ -203,25 +203,25 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
203
203
  end
204
204
  respond_to?( :extended ).should == true
205
205
  module ModuleProof
206
- include ModuleCluster::Define::Block::ClassOrInstance::Mock06
206
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
207
207
  end
208
208
  block_ran.should == false
209
209
  module ModuleProof2
210
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock06
210
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
211
211
  end
212
212
  block_ran.should == false
213
213
  class ClassProof
214
- include ModuleCluster::Define::Block::ClassOrInstance::Mock06
214
+ include ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
215
215
  end
216
216
  block_ran.should == true
217
217
  block_ran = false
218
218
  class ClassProof2
219
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock06
219
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
220
220
  end
221
221
  block_ran.should == true
222
222
  block_ran = false
223
223
  Object.new.instance_eval do
224
- extend ModuleCluster::Define::Block::ClassOrInstance::Mock06
224
+ extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
225
225
  end
226
226
  block_ran.should == true
227
227
  end
@@ -9,7 +9,7 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
9
9
 
10
10
  it 'can run a block on class or module extend' do
11
11
  module ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
12
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance
12
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
13
13
  block_ran = false
14
14
  class_or_module_or_instance_extend do
15
15
  block_ran = true
@@ -17,25 +17,25 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
17
17
  end
18
18
  respond_to?( :extended ).should == true
19
19
  module ModuleProof
20
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
20
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
21
21
  end
22
22
  block_ran.should == false
23
23
  module ModuleProof2
24
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
24
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
25
25
  end
26
26
  block_ran.should == true
27
27
  block_ran = false
28
28
  class ClassProof
29
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
29
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
30
30
  end
31
31
  block_ran.should == false
32
32
  class ClassProof2
33
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
33
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
34
34
  end
35
35
  block_ran.should == true
36
36
  block_ran = false
37
37
  Object.new.instance_eval do
38
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
38
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
39
39
  end
40
40
  block_ran.should == true
41
41
  end
@@ -47,7 +47,7 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
47
47
 
48
48
  it 'can run a block on class or module include or instance extend' do
49
49
  module ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
50
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance
50
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
51
51
  block_ran = false
52
52
  class_or_module_include_or_instance_extend do
53
53
  block_ran = true
@@ -55,25 +55,25 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
55
55
  end
56
56
  respond_to?( :extended ).should == true
57
57
  module ModuleProof
58
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
58
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
59
59
  end
60
60
  block_ran.should == true
61
61
  block_ran = false
62
62
  module ModuleProof2
63
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
63
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
64
64
  end
65
65
  block_ran.should == false
66
66
  class ClassProof
67
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
67
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
68
68
  end
69
69
  block_ran.should == true
70
70
  block_ran = false
71
71
  class ClassProof2
72
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
72
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
73
73
  end
74
74
  block_ran.should == false
75
75
  Object.new.instance_eval do
76
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
76
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
77
77
  end
78
78
  block_ran.should == true
79
79
  end
@@ -85,7 +85,7 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
85
85
 
86
86
  it 'can run a block on class or module include or extend or instance extend' do
87
87
  module ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
88
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance
88
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
89
89
  block_ran = false
90
90
  class_or_module_include_or_extend_or_instance_extend do
91
91
  block_ran = true
@@ -93,27 +93,27 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
93
93
  end
94
94
  respond_to?( :extended ).should == true
95
95
  module ModuleProof
96
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
96
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
97
97
  end
98
98
  block_ran.should == true
99
99
  block_ran = false
100
100
  module ModuleProof2
101
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
101
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
102
102
  end
103
103
  block_ran.should == true
104
104
  block_ran = false
105
105
  class ClassProof
106
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
106
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
107
107
  end
108
108
  block_ran.should == true
109
109
  block_ran = false
110
110
  class ClassProof2
111
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
111
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
112
112
  end
113
113
  block_ran.should == true
114
114
  block_ran = false
115
115
  Object.new.instance_eval do
116
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
116
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
117
117
  end
118
118
  block_ran.should == true
119
119
  end
@@ -125,7 +125,7 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
125
125
 
126
126
  it 'can run a block before class or module extend' do
127
127
  module ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
128
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance
128
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
129
129
  block_ran = false
130
130
  prepend_class_or_module_or_instance_extend do
131
131
  block_ran = true
@@ -133,25 +133,25 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
133
133
  end
134
134
  respond_to?( :extended ).should == true
135
135
  module ModuleProof
136
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
136
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
137
137
  end
138
138
  block_ran.should == false
139
139
  module ModuleProof2
140
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
140
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
141
141
  end
142
142
  block_ran.should == true
143
143
  block_ran = false
144
144
  class ClassProof
145
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
145
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
146
146
  end
147
147
  block_ran.should == false
148
148
  class ClassProof2
149
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
149
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
150
150
  end
151
151
  block_ran.should == true
152
152
  block_ran = false
153
153
  Object.new.instance_eval do
154
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
154
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
155
155
  end
156
156
  block_ran.should == true
157
157
  end
@@ -163,7 +163,7 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
163
163
 
164
164
  it 'can run a block before class or module include or instance extend' do
165
165
  module ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
166
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance
166
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
167
167
  block_ran = false
168
168
  prepend_class_or_module_include_or_instance_extend do
169
169
  block_ran = true
@@ -171,25 +171,25 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
171
171
  end
172
172
  respond_to?( :extended ).should == true
173
173
  module ModuleProof
174
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
174
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
175
175
  end
176
176
  block_ran.should == true
177
177
  block_ran = false
178
178
  module ModuleProof2
179
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
179
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
180
180
  end
181
181
  block_ran.should == false
182
182
  class ClassProof
183
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
183
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
184
184
  end
185
185
  block_ran.should == true
186
186
  block_ran = false
187
187
  class ClassProof2
188
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
188
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
189
189
  end
190
190
  block_ran.should == false
191
191
  Object.new.instance_eval do
192
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
192
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
193
193
  end
194
194
  block_ran.should == true
195
195
  end
@@ -201,7 +201,7 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
201
201
 
202
202
  it 'can run a block before class or module include or extend or instance extend' do
203
203
  module ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
204
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance
204
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
205
205
  block_ran = false
206
206
  prepend_class_or_module_include_or_extend_or_instance_extend do
207
207
  block_ran = true
@@ -209,27 +209,27 @@ describe ModuleCluster::Define::Block::ClassOrModuleOrInstance do
209
209
  end
210
210
  respond_to?( :extended ).should == true
211
211
  module ModuleProof
212
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
212
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
213
213
  end
214
214
  block_ran.should == true
215
215
  block_ran = false
216
216
  module ModuleProof2
217
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
217
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
218
218
  end
219
219
  block_ran.should == true
220
220
  block_ran = false
221
221
  class ClassProof
222
- include ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
222
+ include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
223
223
  end
224
224
  block_ran.should == true
225
225
  block_ran = false
226
226
  class ClassProof2
227
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
227
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
228
228
  end
229
229
  block_ran.should == true
230
230
  block_ran = false
231
231
  Object.new.instance_eval do
232
- extend ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
232
+ extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
233
233
  end
234
234
  block_ran.should == true
235
235
  end