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.
- data/README.md +127 -337
- data/lib/module-cluster.rb +1 -153
- data/lib/module/cluster.rb +341 -0
- data/lib/module/cluster/class_support.rb +22 -0
- data/lib/module/cluster/cluster.rb +10 -0
- data/lib/module/cluster/cluster/cluster_interface.rb +550 -0
- data/lib/module/cluster/exception/module_not_in_stack.rb +26 -0
- data/lib/module/cluster/instance_controller.rb +14 -0
- data/lib/module/cluster/instance_controller/hook_controller.rb +33 -0
- data/lib/module/cluster/instance_controller/hook_controller/chain_proxy.rb +511 -0
- data/lib/module/cluster/instance_controller/hook_controller/hook_controller_interface.rb +830 -0
- data/lib/module/cluster/instance_controller/instance_controller_interface.rb +269 -0
- data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb +359 -0
- data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy/chain_proxy.rb +442 -0
- data/lib/module/cluster/module_support.rb +67 -0
- data/lib/module/namespaces.rb +13 -0
- data/lib/module/requires.rb +32 -0
- data/spec/module/cluster/cluster_spec.rb +473 -0
- data/spec/module/cluster/instance_controller/hook_controller_spec.rb +922 -0
- data/spec/module/cluster/instance_controller/multiple_hook_controller_proxy_spec.rb +1240 -0
- data/spec/module/cluster_spec.rb +1794 -0
- metadata +27 -98
- data/README.rdoc +0 -395
- data/lib/module-cluster/ModuleCluster.rb +0 -9
- data/lib/module-cluster/ModuleCluster/Define.rb +0 -12
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +0 -9
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClass.rb +0 -83
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb +0 -70
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModule.rb +0 -79
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb +0 -21
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +0 -77
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +0 -36
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +0 -29
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +0 -45
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +0 -77
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +0 -29
- data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +0 -56
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +0 -193
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +0 -128
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +0 -185
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +0 -40
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +0 -45
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -193
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +0 -209
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +0 -128
- data/lib/module-cluster/ModuleCluster/Define/Status.rb +0 -106
- data/lib/module-cluster/ModuleCluster/Suspend.rb +0 -7
- data/lib/module-cluster/ModuleCluster/Suspend/Hooks.rb +0 -315
- data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +0 -153
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +0 -77
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +0 -44
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +0 -292
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/Subclass.rb +0 -24
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +0 -12
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +0 -9
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Inherited.rb +0 -20
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +0 -20
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +0 -6
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +0 -140
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +0 -110
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -140
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -110
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +0 -35
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy.rb +0 -359
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Status.rb +0 -55
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Suspend.rb +0 -199
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +0 -34
- data/spec/ModuleCluster/Define/Block/CascadingClassOrModule_spec.rb +0 -285
- data/spec/ModuleCluster/Define/Block/CascadingClass_spec.rb +0 -254
- data/spec/ModuleCluster/Define/Block/CascadingModuleOrSubclass_spec.rb +0 -56
- data/spec/ModuleCluster/Define/Block/CascadingModule_spec.rb +0 -278
- data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +0 -230
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +0 -238
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +0 -231
- data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/Class_spec.rb +0 -224
- data/spec/ModuleCluster/Define/Block/Instance_spec.rb +0 -78
- data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +0 -51
- data/spec/ModuleCluster/Define/Block/Module_spec.rb +0 -230
- data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +0 -73
- data/spec/ModuleCluster/Define/Block_spec.rb +0 -18
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +0 -576
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +0 -659
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +0 -678
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +0 -644
- data/spec/ModuleCluster/Define/Cluster_spec.rb +0 -708
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +0 -102
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +0 -576
- data/spec/ModuleCluster/Suspend/Hooks_spec.rb +0 -573
- data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +0 -559
- data/spec/ModuleCluster_spec.rb +0 -15
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +0 -386
- data/spec/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy_spec.rb +0 -419
- data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +0 -242
@@ -0,0 +1,269 @@
|
|
1
|
+
|
2
|
+
###
|
3
|
+
# @private
|
4
|
+
#
|
5
|
+
# Interface implementation for {::Module::Cluster::InstanceController Module::Cluster::InstanceController}.
|
6
|
+
# Implementation provided separately for ease of overloading.
|
7
|
+
#
|
8
|
+
module ::Module::Cluster::InstanceController::InstanceControllerInterface
|
9
|
+
|
10
|
+
################
|
11
|
+
# initialize #
|
12
|
+
################
|
13
|
+
|
14
|
+
###
|
15
|
+
#
|
16
|
+
# @param instance Object instance for which Instance Controller is to operate.
|
17
|
+
#
|
18
|
+
def initialize( instance )
|
19
|
+
|
20
|
+
@instance = instance
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
#########################
|
25
|
+
# subclass_controller #
|
26
|
+
#########################
|
27
|
+
|
28
|
+
###
|
29
|
+
# Returns subclass hook controller.
|
30
|
+
#
|
31
|
+
# @return [Module::Cluster::InstanceController::HookController] Subclass hook controller.
|
32
|
+
#
|
33
|
+
def subclass_controller
|
34
|
+
|
35
|
+
return @subclass_controller ||= self.class::HookController.new( :subclass, self )
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
###############################
|
40
|
+
# before_include_controller #
|
41
|
+
###############################
|
42
|
+
|
43
|
+
###
|
44
|
+
# Returns before-include hook controller.
|
45
|
+
#
|
46
|
+
# @return [Module::Cluster::InstanceController::HookController] Before-include hook controller.
|
47
|
+
#
|
48
|
+
def before_include_controller
|
49
|
+
|
50
|
+
return @before_include_controller ||= self.class::HookController.new( :before_include, self )
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
##############################
|
55
|
+
# before_extend_controller #
|
56
|
+
##############################
|
57
|
+
|
58
|
+
###
|
59
|
+
# Returns before-extend hook controller.
|
60
|
+
#
|
61
|
+
# @return [Module::Cluster::InstanceController::HookController] Before-extend hook controller.
|
62
|
+
#
|
63
|
+
def before_extend_controller
|
64
|
+
|
65
|
+
return @before_extend_controller ||= self.class::HookController.new( :before_extend, self )
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
#################################
|
70
|
+
# before_include_extend_proxy #
|
71
|
+
#################################
|
72
|
+
|
73
|
+
###
|
74
|
+
# Returns a multi-controller proxy for before-include and before-extend hook controllers.
|
75
|
+
#
|
76
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy]
|
77
|
+
# Before-include-extend hook controller proxy.
|
78
|
+
#
|
79
|
+
def before_include_extend_proxy
|
80
|
+
|
81
|
+
return @before_include_extend_proxy ||= self.class::MultipleHookControllerProxy.new( :before_include_extend,
|
82
|
+
before_include_controller,
|
83
|
+
before_extend_controller )
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
###################################
|
88
|
+
# before_include_subclass_proxy #
|
89
|
+
###################################
|
90
|
+
|
91
|
+
###
|
92
|
+
# Returns a multi-controller proxy for before-include and subclass hook controllers.
|
93
|
+
#
|
94
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy]
|
95
|
+
# Before-include-subclass hook controller proxy.
|
96
|
+
#
|
97
|
+
def before_include_subclass_proxy
|
98
|
+
|
99
|
+
return @before_include_subclass_proxy ||= self.class::MultipleHookControllerProxy.new( :before_include_subclass,
|
100
|
+
before_include_controller,
|
101
|
+
subclass_controller )
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
##################################
|
106
|
+
# before_extend_subclass_proxy #
|
107
|
+
##################################
|
108
|
+
|
109
|
+
###
|
110
|
+
# Returns a multi-controller proxy for before-extend and subclass hook controllers.
|
111
|
+
#
|
112
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy]
|
113
|
+
# Before-extend-subclass hook controller proxy.
|
114
|
+
#
|
115
|
+
def before_extend_subclass_proxy
|
116
|
+
|
117
|
+
return @before_extend_subclass_proxy ||= self.class::MultipleHookControllerProxy.new( :before_extend_subclass,
|
118
|
+
before_include_controller,
|
119
|
+
subclass_controller )
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
##########################################
|
124
|
+
# before_include_extend_subclass_proxy #
|
125
|
+
##########################################
|
126
|
+
|
127
|
+
###
|
128
|
+
# Returns a multi-controller proxy for before-include, before-extend, and subclass hook controllers.
|
129
|
+
#
|
130
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy]
|
131
|
+
# Before-include-extend-subclass hook controller proxy.
|
132
|
+
#
|
133
|
+
def before_include_extend_subclass_proxy
|
134
|
+
|
135
|
+
@before_include_extend_subclass_proxy ||= self.class::
|
136
|
+
MultipleHookControllerProxy.new( :before_include_extend_subclass,
|
137
|
+
before_include_controller,
|
138
|
+
before_extend_controller,
|
139
|
+
subclass_controller )
|
140
|
+
return @before_include_extend_subclass_proxy
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
##############################
|
145
|
+
# after_include_controller #
|
146
|
+
##############################
|
147
|
+
|
148
|
+
###
|
149
|
+
# Returns after-include hook controller.
|
150
|
+
#
|
151
|
+
# @return [Module::Cluster::InstanceController::HookController] After-include hook controller.
|
152
|
+
#
|
153
|
+
def after_include_controller
|
154
|
+
|
155
|
+
return @after_include_controller ||= self.class::HookController.new( :after_include, self )
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
#############################
|
160
|
+
# after_extend_controller #
|
161
|
+
#############################
|
162
|
+
|
163
|
+
###
|
164
|
+
# Returns after-extend hook controller.
|
165
|
+
#
|
166
|
+
# @return [Module::Cluster::InstanceController::HookController] After-extend hook controller.
|
167
|
+
#
|
168
|
+
def after_extend_controller
|
169
|
+
|
170
|
+
return @after_extend_controller ||= self.class::HookController.new( :after_extend, self )
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
################################
|
175
|
+
# after_include_extend_proxy #
|
176
|
+
################################
|
177
|
+
|
178
|
+
###
|
179
|
+
# Returns a multi-controller proxy for after-include and after-extend hook controllers.
|
180
|
+
#
|
181
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy]
|
182
|
+
# After-include-extend hook controller proxy.
|
183
|
+
#
|
184
|
+
def after_include_extend_proxy
|
185
|
+
|
186
|
+
return @after_include_extend_proxy ||= self.class::MultipleHookControllerProxy.new( :after_include_extend,
|
187
|
+
after_include_controller,
|
188
|
+
after_extend_controller )
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
##################################
|
193
|
+
# after_include_subclass_proxy #
|
194
|
+
##################################
|
195
|
+
|
196
|
+
###
|
197
|
+
# Returns a multi-controller proxy for after-include and subclass hook controllers.
|
198
|
+
#
|
199
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy]
|
200
|
+
# After-include-subclass hook controller proxy.
|
201
|
+
#
|
202
|
+
def after_include_subclass_proxy
|
203
|
+
|
204
|
+
return @after_include_subclass_proxy ||= self.class::MultipleHookControllerProxy.new( :after_include_subclass,
|
205
|
+
after_include_controller,
|
206
|
+
subclass_controller )
|
207
|
+
|
208
|
+
end
|
209
|
+
|
210
|
+
#################################
|
211
|
+
# after_extend_subclass_proxy #
|
212
|
+
#################################
|
213
|
+
|
214
|
+
###
|
215
|
+
# Returns a multi-controller proxy for after-extend and subclass hook controllers.
|
216
|
+
#
|
217
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy]
|
218
|
+
# After-extend-subclass hook controller proxy.
|
219
|
+
#
|
220
|
+
def after_extend_subclass_proxy
|
221
|
+
|
222
|
+
return @after_extend_subclass_proxy ||= self.class::MultipleHookControllerProxy.new( :after_extend_subclass,
|
223
|
+
after_extend_controller,
|
224
|
+
subclass_controller )
|
225
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
#########################################
|
229
|
+
# after_include_extend_subclass_proxy #
|
230
|
+
#########################################
|
231
|
+
|
232
|
+
###
|
233
|
+
# Returns a multi-controller proxy for after-include, after-extend, and subclass hook controllers.
|
234
|
+
#
|
235
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy]
|
236
|
+
# After-include-extend-subclass hook controller proxy.
|
237
|
+
#
|
238
|
+
def after_include_extend_subclass_proxy
|
239
|
+
|
240
|
+
@after_include_extend_subclass_proxy ||= self.class::
|
241
|
+
MultipleHookControllerProxy.new( :after_include_extend_subclass,
|
242
|
+
after_include_controller,
|
243
|
+
after_extend_controller,
|
244
|
+
subclass_controller )
|
245
|
+
return @after_include_extend_subclass_proxy
|
246
|
+
|
247
|
+
end
|
248
|
+
|
249
|
+
######################################################################################################################
|
250
|
+
# private ##########################################################################################################
|
251
|
+
######################################################################################################################
|
252
|
+
|
253
|
+
###
|
254
|
+
# These methods are not actually in private space but are internal methods for inter-object
|
255
|
+
# communications. They aren't intended for public interfacing.
|
256
|
+
#
|
257
|
+
|
258
|
+
##############
|
259
|
+
# instance #
|
260
|
+
##############
|
261
|
+
|
262
|
+
###
|
263
|
+
# Get reference to object instance for which Instance Controller (self) is operative.
|
264
|
+
#
|
265
|
+
# @!attribute [reader] Object instance for which this Instance Controller operates.
|
266
|
+
#
|
267
|
+
attr_reader :instance
|
268
|
+
|
269
|
+
end
|
@@ -0,0 +1,359 @@
|
|
1
|
+
|
2
|
+
###
|
3
|
+
# Proxies before include or extend definitions to both include and extend controllers.
|
4
|
+
#
|
5
|
+
class ::Module::Cluster::InstanceController::MultipleHookControllerProxy
|
6
|
+
|
7
|
+
################
|
8
|
+
# initialize #
|
9
|
+
################
|
10
|
+
|
11
|
+
###
|
12
|
+
# @private
|
13
|
+
#
|
14
|
+
# @param name Name of this Multiple Hook Controller Proxy.
|
15
|
+
#
|
16
|
+
# @param hook_controllers Hook Controllers for which this Proxy is operative.
|
17
|
+
#
|
18
|
+
def initialize( name, *hook_controllers )
|
19
|
+
|
20
|
+
@name = name
|
21
|
+
|
22
|
+
@hook_controllers = hook_controllers
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
#############
|
27
|
+
# include #
|
28
|
+
#############
|
29
|
+
|
30
|
+
###
|
31
|
+
# Declare that modules should be included at event hook.
|
32
|
+
#
|
33
|
+
# @overload include( module, ..., & block )
|
34
|
+
#
|
35
|
+
# @param module Module to include at event hook.
|
36
|
+
#
|
37
|
+
# @yield [hooked_instance] Block for event hook action.
|
38
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
39
|
+
# Equivalent to parameter for #included and #extended.
|
40
|
+
#
|
41
|
+
# @return [Module::Cluster::InstanceController::HookController] self
|
42
|
+
#
|
43
|
+
def include( *modules )
|
44
|
+
|
45
|
+
@hook_controllers.each do |this_hook_controller|
|
46
|
+
this_hook_controller.include( *modules )
|
47
|
+
end
|
48
|
+
|
49
|
+
return self
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
############
|
54
|
+
# extend #
|
55
|
+
############
|
56
|
+
|
57
|
+
###
|
58
|
+
# Declare that modules should be extended at event hook.
|
59
|
+
#
|
60
|
+
# @overload extend( module, ..., & block )
|
61
|
+
#
|
62
|
+
# @param module Module to extend at event hook.
|
63
|
+
#
|
64
|
+
# @yield [hooked_instance] Block for event hook action.
|
65
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
66
|
+
# Equivalent to parameter for #included and #extended.
|
67
|
+
#
|
68
|
+
# @return [Module::Cluster::InstanceController::HookController] self
|
69
|
+
#
|
70
|
+
def extend( *modules )
|
71
|
+
|
72
|
+
@hook_controllers.each do |this_hook_controller|
|
73
|
+
this_hook_controller.extend( *modules )
|
74
|
+
end
|
75
|
+
|
76
|
+
return self
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
########################
|
81
|
+
# include_and_extend #
|
82
|
+
########################
|
83
|
+
|
84
|
+
###
|
85
|
+
# Declare that modules should be included and extended at event hook. See also #extend_and_include.
|
86
|
+
#
|
87
|
+
# @overload include_and_extend( module, ..., & block )
|
88
|
+
#
|
89
|
+
# @param module Module to include and extend at event hook.
|
90
|
+
#
|
91
|
+
# @yield [hooked_instance] Block for event hook action.
|
92
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
93
|
+
# Equivalent to parameter for #included and #extended.
|
94
|
+
#
|
95
|
+
# @return [Module::Cluster::InstanceController::HookController] self
|
96
|
+
#
|
97
|
+
def include_and_extend( *modules )
|
98
|
+
|
99
|
+
@hook_controllers.each do |this_hook_controller|
|
100
|
+
this_hook_controller.include_and_extend( *modules )
|
101
|
+
end
|
102
|
+
|
103
|
+
return self
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
########################
|
108
|
+
# extend_and_include #
|
109
|
+
########################
|
110
|
+
|
111
|
+
###
|
112
|
+
# Declare that modules should be extended and included at event hook. Order is reversed from #include_and_extend.
|
113
|
+
#
|
114
|
+
# @overload extend_and_include( module, ..., & block )
|
115
|
+
#
|
116
|
+
# @param module Module to extend and include at event hook.
|
117
|
+
#
|
118
|
+
# @yield [hooked_instance] Block for event hook action.
|
119
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
120
|
+
# Equivalent to parameter for #included and #extended.
|
121
|
+
#
|
122
|
+
# @return [Module::Cluster::InstanceController::HookController] self
|
123
|
+
#
|
124
|
+
def extend_and_include( *modules )
|
125
|
+
|
126
|
+
@hook_controllers.each do |this_hook_controller|
|
127
|
+
this_hook_controller.extend_and_include( *modules )
|
128
|
+
end
|
129
|
+
|
130
|
+
return self
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
############
|
135
|
+
# action #
|
136
|
+
############
|
137
|
+
|
138
|
+
###
|
139
|
+
# Declare that action should be performed at event hook.
|
140
|
+
#
|
141
|
+
# @yield [hooked_instance] Block for event hook action.
|
142
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
143
|
+
# Equivalent to parameter for #included and #extended.
|
144
|
+
#
|
145
|
+
# @return [Module::Cluster::InstanceController::HookController] self
|
146
|
+
#
|
147
|
+
def action( & block )
|
148
|
+
|
149
|
+
@hook_controllers.each do |this_hook_controller|
|
150
|
+
this_hook_controller.action( & block )
|
151
|
+
end
|
152
|
+
|
153
|
+
return self
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
###################
|
158
|
+
# before_extend #
|
159
|
+
###################
|
160
|
+
|
161
|
+
###
|
162
|
+
# Declare that chained actions should be inserted into the event stack prior to the location
|
163
|
+
# in the same event stack where provided module(s) are specified to be extended.
|
164
|
+
#
|
165
|
+
# @overload before_extend( module, ..., & block )
|
166
|
+
#
|
167
|
+
# @param module Module that insert should be prior to.
|
168
|
+
#
|
169
|
+
# @yield [hooked_instance] Block for event hook action.
|
170
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
171
|
+
# Equivalent to parameter for #included and #extended.
|
172
|
+
#
|
173
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy] Chain Proxy for chained declarations.
|
174
|
+
#
|
175
|
+
def before_extend( *modules )
|
176
|
+
|
177
|
+
return chain_proxy.before_extend( *modules )
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
####################
|
182
|
+
# before_include #
|
183
|
+
####################
|
184
|
+
|
185
|
+
###
|
186
|
+
# Declare that chained actions should be inserted into the event stack prior to the location
|
187
|
+
# in the same event stack where provided module(s) are specified to be included.
|
188
|
+
#
|
189
|
+
# @overload before_include( module, ..., & block )
|
190
|
+
#
|
191
|
+
# @param module Module that insert should be prior to.
|
192
|
+
#
|
193
|
+
# @yield [hooked_instance] Block for event hook action.
|
194
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
195
|
+
# Equivalent to parameter for #included and #extended.
|
196
|
+
#
|
197
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy] Chain Proxy for chained declarations.
|
198
|
+
#
|
199
|
+
def before_include( *modules )
|
200
|
+
|
201
|
+
return chain_proxy.before_include( *modules )
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
##############################
|
206
|
+
# before_include_or_extend #
|
207
|
+
# before_extend_or_include #
|
208
|
+
##############################
|
209
|
+
|
210
|
+
###
|
211
|
+
# Declare that chained actions should be inserted into the event stack prior to the location
|
212
|
+
# in the same event stack where provided module(s) are specified to be included or extended.
|
213
|
+
#
|
214
|
+
# @overload before_include_or_extend( module, ..., & block )
|
215
|
+
#
|
216
|
+
# @param module Module that insert should be prior to.
|
217
|
+
#
|
218
|
+
# @yield [hooked_instance] Block for event hook action.
|
219
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
220
|
+
# Equivalent to parameter for #included and #extended.
|
221
|
+
#
|
222
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy] Chain Proxy for chained declarations.
|
223
|
+
#
|
224
|
+
def before_include_or_extend( *modules )
|
225
|
+
|
226
|
+
return chain_proxy.before_include_or_extend( *modules )
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
alias_method :before_extend_or_include, :before_include_or_extend
|
231
|
+
|
232
|
+
###################
|
233
|
+
# after_include #
|
234
|
+
###################
|
235
|
+
|
236
|
+
###
|
237
|
+
# Declare that chained actions should be inserted into the event stack after the location
|
238
|
+
# in the same event stack where provided module(s) are specified to be included.
|
239
|
+
#
|
240
|
+
# @overload before_include( module, ..., & block )
|
241
|
+
#
|
242
|
+
# @param module Module that insert should be after.
|
243
|
+
#
|
244
|
+
# @yield [hooked_instance] Block for event hook action.
|
245
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
246
|
+
# Equivalent to parameter for #included and #extended.
|
247
|
+
#
|
248
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy] Chain Proxy for chained declarations.
|
249
|
+
#
|
250
|
+
def after_include( *modules )
|
251
|
+
|
252
|
+
return chain_proxy.after_include( *modules )
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
##################
|
257
|
+
# after_extend #
|
258
|
+
##################
|
259
|
+
|
260
|
+
###
|
261
|
+
# Declare that chained actions should be inserted into the event stack after the location
|
262
|
+
# in the same event stack where provided module(s) are specified to be extended.
|
263
|
+
#
|
264
|
+
# @overload before_extend( module, ..., & block )
|
265
|
+
#
|
266
|
+
# @param module Module that insert should be after.
|
267
|
+
#
|
268
|
+
# @yield [hooked_instance] Block for event hook action.
|
269
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
270
|
+
# Equivalent to parameter for #included and #extended.
|
271
|
+
#
|
272
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy] Chain Proxy for chained declarations.
|
273
|
+
#
|
274
|
+
def after_extend( *modules )
|
275
|
+
|
276
|
+
return chain_proxy.after_extend( *modules )
|
277
|
+
|
278
|
+
end
|
279
|
+
|
280
|
+
#############################
|
281
|
+
# after_include_or_extend #
|
282
|
+
# after_extend_or_include #
|
283
|
+
#############################
|
284
|
+
|
285
|
+
###
|
286
|
+
# Declare that chained actions should be inserted into the event stack after the location
|
287
|
+
# in the same event stack where provided module(s) are specified to be included or extended.
|
288
|
+
#
|
289
|
+
# @overload before_include_or_extend( module, ..., & block )
|
290
|
+
#
|
291
|
+
# @param module Module that insert should be after.
|
292
|
+
#
|
293
|
+
# @yield [hooked_instance] Block for event hook action.
|
294
|
+
# @yieldparam hooked_instance Instance for which event hook is occurring.
|
295
|
+
# Equivalent to parameter for #included and #extended.
|
296
|
+
#
|
297
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy] Chain Proxy for chained declarations.
|
298
|
+
#
|
299
|
+
def after_include_or_extend( *modules )
|
300
|
+
|
301
|
+
return chain_proxy.after_include_or_extend( *modules )
|
302
|
+
|
303
|
+
end
|
304
|
+
|
305
|
+
alias_method :after_extend_or_include, :after_include_or_extend
|
306
|
+
|
307
|
+
######################################################################################################################
|
308
|
+
# private ##########################################################################################################
|
309
|
+
######################################################################################################################
|
310
|
+
|
311
|
+
###
|
312
|
+
# These methods are not actually in private space but are internal methods for inter-object
|
313
|
+
# communications. They aren't intended for public interfacing.
|
314
|
+
#
|
315
|
+
|
316
|
+
#################
|
317
|
+
# chain_proxy #
|
318
|
+
#################
|
319
|
+
|
320
|
+
###
|
321
|
+
# @private
|
322
|
+
#
|
323
|
+
# Get Chain Proxy instance used by this Multiple Hook Controller Proxy.
|
324
|
+
#
|
325
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy] Chain Proxy instance.
|
326
|
+
#
|
327
|
+
def chain_proxy
|
328
|
+
|
329
|
+
return @chain_proxy ||= self.class::ChainProxy.new( self )
|
330
|
+
|
331
|
+
end
|
332
|
+
|
333
|
+
##########
|
334
|
+
# name #
|
335
|
+
##########
|
336
|
+
|
337
|
+
###
|
338
|
+
# @private
|
339
|
+
#
|
340
|
+
# Name of hook controller.
|
341
|
+
#
|
342
|
+
# @return [Symbol,String] Name.
|
343
|
+
#
|
344
|
+
attr_reader :name
|
345
|
+
|
346
|
+
######################
|
347
|
+
# hook_controllers #
|
348
|
+
######################
|
349
|
+
|
350
|
+
###
|
351
|
+
# @private
|
352
|
+
#
|
353
|
+
# @!attribute [reader] Hook Controllers this Proxy proxies.
|
354
|
+
#
|
355
|
+
# @return [Array<Module::Cluster::InstanceController::HookController>] Hook Controllers this Proxy proxies.
|
356
|
+
#
|
357
|
+
attr_reader :hook_controllers
|
358
|
+
|
359
|
+
end
|