module-cluster 1.4.8 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/README.md +127 -337
  2. data/lib/module-cluster.rb +1 -153
  3. data/lib/module/cluster.rb +341 -0
  4. data/lib/module/cluster/class_support.rb +22 -0
  5. data/lib/module/cluster/cluster.rb +10 -0
  6. data/lib/module/cluster/cluster/cluster_interface.rb +550 -0
  7. data/lib/module/cluster/exception/module_not_in_stack.rb +26 -0
  8. data/lib/module/cluster/instance_controller.rb +14 -0
  9. data/lib/module/cluster/instance_controller/hook_controller.rb +33 -0
  10. data/lib/module/cluster/instance_controller/hook_controller/chain_proxy.rb +511 -0
  11. data/lib/module/cluster/instance_controller/hook_controller/hook_controller_interface.rb +830 -0
  12. data/lib/module/cluster/instance_controller/instance_controller_interface.rb +269 -0
  13. data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb +359 -0
  14. data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy/chain_proxy.rb +442 -0
  15. data/lib/module/cluster/module_support.rb +67 -0
  16. data/lib/module/namespaces.rb +13 -0
  17. data/lib/module/requires.rb +32 -0
  18. data/spec/module/cluster/cluster_spec.rb +473 -0
  19. data/spec/module/cluster/instance_controller/hook_controller_spec.rb +922 -0
  20. data/spec/module/cluster/instance_controller/multiple_hook_controller_proxy_spec.rb +1240 -0
  21. data/spec/module/cluster_spec.rb +1794 -0
  22. metadata +27 -98
  23. data/README.rdoc +0 -395
  24. data/lib/module-cluster/ModuleCluster.rb +0 -9
  25. data/lib/module-cluster/ModuleCluster/Define.rb +0 -12
  26. data/lib/module-cluster/ModuleCluster/Define/Block.rb +0 -9
  27. data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClass.rb +0 -83
  28. data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb +0 -70
  29. data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModule.rb +0 -79
  30. data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb +0 -21
  31. data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +0 -77
  32. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +0 -78
  33. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +0 -78
  34. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +0 -78
  35. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +0 -36
  36. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +0 -29
  37. data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +0 -45
  38. data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +0 -77
  39. data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +0 -78
  40. data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +0 -29
  41. data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +0 -56
  42. data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +0 -193
  43. data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +0 -128
  44. data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +0 -181
  45. data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +0 -185
  46. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +0 -181
  47. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +0 -181
  48. data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +0 -40
  49. data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +0 -45
  50. data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -193
  51. data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +0 -209
  52. data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +0 -128
  53. data/lib/module-cluster/ModuleCluster/Define/Status.rb +0 -106
  54. data/lib/module-cluster/ModuleCluster/Suspend.rb +0 -7
  55. data/lib/module-cluster/ModuleCluster/Suspend/Hooks.rb +0 -315
  56. data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +0 -153
  57. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +0 -77
  58. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +0 -44
  59. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +0 -292
  60. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/Subclass.rb +0 -24
  61. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +0 -12
  62. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +0 -9
  63. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
  64. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Inherited.rb +0 -20
  65. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +0 -20
  66. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
  67. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +0 -6
  68. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +0 -140
  69. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +0 -110
  70. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -140
  71. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -110
  72. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +0 -35
  73. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy.rb +0 -359
  74. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Status.rb +0 -55
  75. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Suspend.rb +0 -199
  76. data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +0 -34
  77. data/spec/ModuleCluster/Define/Block/CascadingClassOrModule_spec.rb +0 -285
  78. data/spec/ModuleCluster/Define/Block/CascadingClass_spec.rb +0 -254
  79. data/spec/ModuleCluster/Define/Block/CascadingModuleOrSubclass_spec.rb +0 -56
  80. data/spec/ModuleCluster/Define/Block/CascadingModule_spec.rb +0 -278
  81. data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +0 -230
  82. data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +0 -238
  83. data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +0 -54
  84. data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +0 -231
  85. data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +0 -54
  86. data/spec/ModuleCluster/Define/Block/Class_spec.rb +0 -224
  87. data/spec/ModuleCluster/Define/Block/Instance_spec.rb +0 -78
  88. data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +0 -54
  89. data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +0 -51
  90. data/spec/ModuleCluster/Define/Block/Module_spec.rb +0 -230
  91. data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +0 -73
  92. data/spec/ModuleCluster/Define/Block_spec.rb +0 -18
  93. data/spec/ModuleCluster/Define/ClassCluster_spec.rb +0 -728
  94. data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +0 -576
  95. data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +0 -659
  96. data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +0 -678
  97. data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +0 -644
  98. data/spec/ModuleCluster/Define/Cluster_spec.rb +0 -708
  99. data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +0 -102
  100. data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -728
  101. data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +0 -728
  102. data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +0 -576
  103. data/spec/ModuleCluster/Suspend/Hooks_spec.rb +0 -573
  104. data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +0 -559
  105. data/spec/ModuleCluster_spec.rb +0 -15
  106. data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +0 -386
  107. data/spec/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy_spec.rb +0 -419
  108. data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +0 -242
@@ -1,55 +0,0 @@
1
-
2
- module ::ModuleCluster::ClusterStack::Status
3
-
4
- ###############
5
- # all_hooks #
6
- ###############
7
-
8
- def all_hooks
9
- return @all_hooks ||= ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( all_include_hooks, all_extend_hooks )
10
- end
11
-
12
- #######################
13
- # all_include_hooks #
14
- #######################
15
-
16
- def all_include_hooks
17
- return @all_include_hooks ||= ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( prepend_include_hooks, include_hooks )
18
- end
19
-
20
- ######################
21
- # all_extend_hooks #
22
- #######################
23
-
24
- def all_extend_hooks
25
- return @all_extend_hooks ||= ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( prepend_extend_hooks, extend_hooks )
26
- end
27
-
28
- ###################
29
- # has_any_hook? #
30
- ###################
31
-
32
- def has_any_hook?( description )
33
- hooks = all_hooks.hooks_with( description )
34
- return hooks ||= false
35
- end
36
-
37
- ###########################
38
- # has_any_include_hook? #
39
- ###########################
40
-
41
- def has_any_include_hook?( description )
42
- hooks = all_include_hooks.hooks_with( description )
43
- return hooks ||= false
44
- end
45
-
46
- ##########################
47
- # has_any_extend_hook? #
48
- ##########################
49
-
50
- def has_any_extend_hook?( description )
51
- hooks = all_extend_hooks.hooks_with( description )
52
- return hooks ||= false
53
- end
54
-
55
- end
@@ -1,199 +0,0 @@
1
-
2
- module ::ModuleCluster::ClusterStack::Suspend
3
-
4
- #######################
5
- # suspend_any_hooks #
6
- #######################
7
-
8
- def suspend_any_hooks
9
- @all_hooks_suspended = true
10
- end
11
-
12
- ###############################
13
- # suspend_any_include_hooks #
14
- ###############################
15
-
16
- def suspend_any_include_hooks
17
- @all_include_hooks_suspended = true
18
- end
19
-
20
- ##############################
21
- # suspend_any_extend_hooks #
22
- ##############################
23
-
24
- def suspend_any_extend_hooks
25
- @all_extend_hooks_suspended = true
26
- end
27
-
28
- ###########################
29
- # suspend_include_hooks #
30
- ###########################
31
-
32
- def suspend_include_hooks
33
- @include_hooks_suspended = true
34
- end
35
-
36
- ##########################
37
- # suspend_extend_hooks #
38
- ##########################
39
-
40
- def suspend_extend_hooks
41
- @extend_hooks_suspended = true
42
- end
43
-
44
- ###################################
45
- # suspend_prepend_include_hooks #
46
- ###################################
47
-
48
- def suspend_prepend_include_hooks
49
- @prepend_include_hooks_suspended = true
50
- end
51
-
52
- ##################################
53
- # suspend_prepend_extend_hooks #
54
- ##################################
55
-
56
- def suspend_prepend_extend_hooks
57
- @prepend_extend_hooks_suspended = true
58
- end
59
-
60
- ######################
61
- # hooks_suspended? #
62
- ######################
63
-
64
- def hooks_suspended?( action )
65
-
66
- return true if all_hooks_suspended?
67
-
68
- case action
69
- when :include
70
- return true if all_include_hooks_suspended?
71
- return true if include_hooks_suspended?
72
- when :extend
73
- return true if all_extend_hooks_suspended?
74
- return true if extend_hooks_suspended?
75
- when :prepend_include
76
- return true if all_include_hooks_suspended?
77
- return true if prepend_include_hooks_suspended?
78
- when :prepend_extend
79
- return true if all_extend_hooks_suspended?
80
- return true if prepend_extend_hooks_suspended?
81
- end
82
-
83
- return false
84
-
85
- end
86
-
87
- ##########################
88
- # all_hooks_suspended? #
89
- ##########################
90
-
91
- def all_hooks_suspended?
92
- return @all_hooks_suspended ||= false
93
- end
94
-
95
- ##################################
96
- # all_include_hooks_suspended? #
97
- ##################################
98
-
99
- def all_include_hooks_suspended?
100
- return ( @all_include_hooks_suspended ||= false ) || all_hooks_suspended?
101
- end
102
-
103
- #################################
104
- # all_extend_hooks_suspended? #
105
- #################################
106
-
107
- def all_extend_hooks_suspended?
108
- return ( @all_extend_hooks_suspended ||= false ) || all_hooks_suspended?
109
- end
110
-
111
- ##############################
112
- # include_hooks_suspended? #
113
- ##############################
114
-
115
- def include_hooks_suspended?
116
- return ( @include_hooks_suspended ||= false ) || all_include_hooks_suspended?
117
- end
118
-
119
- #############################
120
- # extend_hooks_suspended? #
121
- #############################
122
-
123
- def extend_hooks_suspended?
124
- return ( @extend_hooks_suspended ||= false ) || all_extend_hooks_suspended?
125
- end
126
-
127
- ######################################
128
- # prepend_include_hooks_suspended? #
129
- ######################################
130
-
131
- def prepend_include_hooks_suspended?
132
- return ( @prepend_include_hooks_suspended ||= false ) || all_include_hooks_suspended?
133
- end
134
-
135
- #####################################
136
- # prepend_extend_hooks_suspended? #
137
- #####################################
138
-
139
- def prepend_extend_hooks_suspended?
140
- return ( @prepend_extend_hooks_suspended ||= false ) || all_extend_hooks_suspended?
141
- end
142
-
143
- ######################
144
- # resume_any_hooks #
145
- ######################
146
-
147
- def resume_any_hooks
148
- @all_hooks_suspended = false
149
- end
150
-
151
- ##############################
152
- # resume_any_include_hooks #
153
- ##############################
154
-
155
- def resume_any_include_hooks
156
- @all_include_hooks_suspended = false
157
- end
158
-
159
- #############################
160
- # resume_any_extend_hooks #
161
- #############################
162
-
163
- def resume_any_extend_hooks
164
- @all_extend_hooks_suspended = false
165
- end
166
-
167
- ##########################
168
- # resume_include_hooks #
169
- ##########################
170
-
171
- def resume_include_hooks
172
- @include_hooks_suspended = false
173
- end
174
-
175
- #########################
176
- # resume_extend_hooks #
177
- #########################
178
-
179
- def resume_extend_hooks
180
- @extend_hooks_suspended = false
181
- end
182
-
183
- ##################################
184
- # resume_prepend_include_hooks #
185
- ##################################
186
-
187
- def resume_prepend_include_hooks
188
- @prepend_include_hooks_suspended = false
189
- end
190
-
191
- #################################
192
- # resume_prepend_extend_hooks #
193
- #################################
194
-
195
- def resume_prepend_extend_hooks
196
- @prepend_extend_hooks_suspended = false
197
- end
198
-
199
- end
@@ -1,34 +0,0 @@
1
-
2
- module ::ModuleCluster::ExtendForCascade
3
-
4
- ##############
5
- # extended #
6
- ##############
7
-
8
- def extended( module_cluster_configuration_instance )
9
-
10
- super
11
-
12
- if module_cluster_configuration_instance.is_a?( Class )
13
-
14
- module_cluster_configuration_instance.module_eval do
15
- # when a module-cluster definition module is used to extend a module,
16
- # define self#extended, self#included, self#append_features, self#extend_object in
17
- # module_cluster_module ( module extended with module-cluster definition module )
18
- extend ::ModuleCluster::CascadeFeatures::Subclass
19
- end
20
-
21
- else
22
-
23
- module_cluster_configuration_instance.instance_eval do
24
- # when a module-cluster definition module is used to extend a module,
25
- # define self#extended, self#included, self#append_features, self#extend_object in
26
- # module_cluster_module ( module extended with module-cluster definition module )
27
- extend ::ModuleCluster::CascadeFeatures
28
- end
29
-
30
- end
31
-
32
- end
33
-
34
- end
@@ -1,285 +0,0 @@
1
-
2
- require_relative '../../../../lib/module-cluster.rb'
3
-
4
- describe ::ModuleCluster::Define::Block::CascadingClassOrModule do
5
-
6
- #######################################
7
- # cascading_class_or_module_include #
8
- #######################################
9
-
10
- it 'can run a block on class or module include' do
11
- module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
12
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule
13
- block_ran = false
14
- cascading_class_or_module_include do
15
- block_ran = true
16
- end
17
- respond_to?( :included ).should == true
18
- class ClassProofExtended
19
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
20
- end
21
- block_ran.should == false
22
- class ClassProof
23
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
24
- end
25
- block_ran.should == true
26
- block_ran = false
27
- class ClassProof2 < ClassProof
28
- end
29
- block_ran.should == true
30
- block_ran = false
31
- Object.new.instance_eval do
32
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
33
- end
34
- block_ran.should == false
35
- module ModuleProofExtended
36
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
37
- end
38
- block_ran.should == false
39
- module ModuleProof
40
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01
41
- end
42
- block_ran.should == true
43
- block_ran = false
44
- module ModuleProof2
45
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock01::ModuleProof
46
- end
47
- block_ran.should == true
48
- end
49
- end
50
-
51
- ######################################
52
- # cascading_class_or_module_extend #
53
- ######################################
54
-
55
- it 'can run a block on class or module extend' do
56
- module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
57
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule
58
- block_ran = false
59
- cascading_class_or_module_extend do
60
- block_ran = true
61
- end
62
- respond_to?( :extended ).should == true
63
- class ClassProof
64
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
65
- end
66
- block_ran.should == false
67
- class ClassProof2 < ClassProof
68
- end
69
- block_ran.should == true
70
- block_ran = false
71
- class ClassProofExtended
72
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
73
- end
74
- block_ran.should == true
75
- block_ran = false
76
- Object.new.instance_eval do
77
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
78
- end
79
- block_ran.should == false
80
- module ModuleProof
81
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
82
- end
83
- block_ran.should == false
84
- module ModuleProofExtended
85
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02
86
- end
87
- block_ran.should == true
88
- block_ran = false
89
- module ModuleProofExtended2
90
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock02::ModuleProofExtended
91
- end
92
- block_ran.should == true
93
- end
94
- end
95
-
96
- #################################################
97
- # cascading_class_or_module_include_or_extend #
98
- #################################################
99
-
100
- it 'can run a block on class or module include or extend' do
101
- module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
102
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule
103
- block_ran = false
104
- cascading_class_or_module_include_or_extend do
105
- block_ran = true
106
- end
107
- respond_to?( :extended ).should == true
108
- class ClassProof
109
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
110
- end
111
- block_ran.should == true
112
- block_ran = false
113
- class ClassProof2 < ClassProof
114
- end
115
- block_ran.should == true
116
- block_ran = false
117
- class ClassProofExtended
118
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
119
- end
120
- block_ran.should == true
121
- block_ran = false
122
- Object.new.instance_eval do
123
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
124
- end
125
- block_ran.should == false
126
- module ModuleProof
127
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
128
- end
129
- block_ran.should == true
130
- block_ran = false
131
- module ModuleProofExtended
132
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03
133
- end
134
- block_ran.should == true
135
- block_ran = false
136
- module ModuleProofExtended2
137
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock03::ModuleProofExtended
138
- end
139
- block_ran.should == true
140
- end
141
- end
142
-
143
- ###############################################
144
- # cascading_prepend_class_or_module_include #
145
- ###############################################
146
-
147
- it 'can run a block before class or module include' do
148
- module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
149
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule
150
- block_ran = false
151
- cascading_prepend_class_or_module_include do
152
- block_ran = true
153
- end
154
- respond_to?( :included ).should == true
155
- class ClassProofExtended
156
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
157
- end
158
- block_ran.should == false
159
- class ClassProof
160
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
161
- end
162
- block_ran.should == true
163
- block_ran = false
164
- class ClassProof2 < ClassProof
165
- end
166
- block_ran.should == true
167
- block_ran = false
168
- Object.new.instance_eval do
169
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
170
- end
171
- block_ran.should == false
172
- module ModuleProofExtended
173
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
174
- end
175
- block_ran.should == false
176
- module ModuleProof
177
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04
178
- end
179
- block_ran.should == true
180
- block_ran = false
181
- module ModuleProof2
182
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock04::ModuleProof
183
- end
184
- block_ran.should == true
185
- end
186
- end
187
-
188
- ##############################################
189
- # cascading_prepend_class_or_module_extend #
190
- ##############################################
191
-
192
- it 'can run a block before class or module extend' do
193
- module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
194
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule
195
- block_ran = false
196
- cascading_prepend_class_or_module_extend do
197
- block_ran = true
198
- end
199
- respond_to?( :extended ).should == true
200
- class ClassProof
201
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
202
- end
203
- block_ran.should == false
204
- class ClassProofExtended
205
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
206
- end
207
- block_ran.should == true
208
- block_ran = false
209
- class ClassProof2 < ClassProof
210
- end
211
- block_ran.should == true
212
- block_ran = false
213
- Object.new.instance_eval do
214
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
215
- end
216
- block_ran.should == false
217
- module ModuleProof
218
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
219
- end
220
- block_ran.should == false
221
- module ModuleProofExtended
222
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05
223
- end
224
- block_ran.should == true
225
- block_ran = false
226
- module ModuleProofExtended2
227
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock05::ModuleProofExtended
228
- end
229
- block_ran.should == true
230
- end
231
- end
232
-
233
- #########################################################
234
- # cascading_prepend_class_or_module_include_or_extend #
235
- #########################################################
236
-
237
- it 'can run a block before class or module include or extend' do
238
- module ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
239
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule
240
- block_ran = false
241
- cascading_prepend_class_or_module_include_or_extend do
242
- block_ran = true
243
- end
244
- respond_to?( :extended ).should == true
245
- class ClassProof
246
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
247
- end
248
- block_ran.should == true
249
- block_ran = false
250
- class ClassProofExtended
251
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
252
- end
253
- block_ran.should == true
254
- block_ran = false
255
- class ClassProof2 < ClassProof
256
- end
257
- block_ran.should == true
258
- block_ran = false
259
- Object.new.instance_eval do
260
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
261
- end
262
- block_ran.should == false
263
- module ModuleProof
264
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
265
- end
266
- block_ran.should == true
267
- block_ran = false
268
- module ModuleProof2
269
- include ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06::ModuleProof
270
- end
271
- block_ran.should == true
272
- block_ran = false
273
- module ModuleProofExtended
274
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06
275
- end
276
- block_ran.should == true
277
- block_ran = false
278
- module ModuleProofExtended2
279
- extend ::ModuleCluster::Define::Block::CascadingClassOrModule::Mock06::ModuleProofExtended
280
- end
281
- block_ran.should == true
282
- end
283
- end
284
-
285
- end