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,22 @@
|
|
1
|
+
|
2
|
+
###
|
3
|
+
# Provides #inherited support for {::Module::Cluster Module::Cluster}.
|
4
|
+
#
|
5
|
+
module ::Module::Cluster::ClassSupport
|
6
|
+
|
7
|
+
###############
|
8
|
+
# inherited #
|
9
|
+
###############
|
10
|
+
|
11
|
+
###
|
12
|
+
# Ensures {::Module::Cluster Module::Cluster} subclass hooks occur at time of subclassing.
|
13
|
+
#
|
14
|
+
def inherited( subclass_instance )
|
15
|
+
|
16
|
+
super if defined?( super )
|
17
|
+
|
18
|
+
::Module::Cluster.hook_cluster_events( self, subclass_instance, :subclass )
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
###
|
3
|
+
# A Cluster controls stacks of event hooks for before/after include/extend/subclass events.
|
4
|
+
# Clusters can be named so that they can be suspended/enabled separately.
|
5
|
+
#
|
6
|
+
class ::Module::Cluster::Cluster
|
7
|
+
|
8
|
+
include ::Module::Cluster::Cluster::ClusterInterface
|
9
|
+
|
10
|
+
end
|
@@ -0,0 +1,550 @@
|
|
1
|
+
|
2
|
+
###
|
3
|
+
# Interface implemenation for ModuleCluster::Cluster::Cluster.
|
4
|
+
# Declared separately so that methods can be easily overridden.
|
5
|
+
#
|
6
|
+
module ::Module::Cluster::Cluster::ClusterInterface
|
7
|
+
|
8
|
+
################
|
9
|
+
# initialize #
|
10
|
+
################
|
11
|
+
|
12
|
+
###
|
13
|
+
#
|
14
|
+
# @param instance Instance cluster is for.
|
15
|
+
#
|
16
|
+
# @param name Name of cluster.
|
17
|
+
#
|
18
|
+
def initialize( instance, name )
|
19
|
+
|
20
|
+
@instance = instance
|
21
|
+
@instance_controller = ::Module::Cluster.instance_controller( instance )
|
22
|
+
@name = name
|
23
|
+
|
24
|
+
@enabled = true
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
##########
|
29
|
+
# name #
|
30
|
+
##########
|
31
|
+
|
32
|
+
###
|
33
|
+
# Name of cluster.
|
34
|
+
#
|
35
|
+
# @!attribute [reader] Cluster name.
|
36
|
+
#
|
37
|
+
# @return [String] Name.
|
38
|
+
#
|
39
|
+
attr_reader :name
|
40
|
+
|
41
|
+
###############
|
42
|
+
# enabled? #
|
43
|
+
###############
|
44
|
+
|
45
|
+
###
|
46
|
+
# Query whether cluster is enabled.
|
47
|
+
#
|
48
|
+
# @return [true,false] Whether cluster is enabled.
|
49
|
+
#
|
50
|
+
def enabled?
|
51
|
+
|
52
|
+
return @enabled
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
################
|
57
|
+
# disabled? #
|
58
|
+
# suspended? #
|
59
|
+
################
|
60
|
+
|
61
|
+
###
|
62
|
+
# Query whether cluster is disabled.
|
63
|
+
#
|
64
|
+
# @return [true,false] Whether cluster is disabled.
|
65
|
+
#
|
66
|
+
def disabled?
|
67
|
+
|
68
|
+
return ! @enabled
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
alias_method :suspended?, :disabled?
|
73
|
+
|
74
|
+
#############
|
75
|
+
# disable #
|
76
|
+
# suspend #
|
77
|
+
#############
|
78
|
+
|
79
|
+
###
|
80
|
+
# Disable cluster.
|
81
|
+
#
|
82
|
+
# @return [Object] Self.
|
83
|
+
#
|
84
|
+
def disable
|
85
|
+
|
86
|
+
@enabled = false
|
87
|
+
|
88
|
+
return self
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
alias_method :suspend, :disable
|
93
|
+
|
94
|
+
############
|
95
|
+
# enable #
|
96
|
+
############
|
97
|
+
|
98
|
+
###
|
99
|
+
# Re-enable cluster.
|
100
|
+
#
|
101
|
+
# @return [Object] Self.
|
102
|
+
#
|
103
|
+
def enable
|
104
|
+
|
105
|
+
@enabled = true
|
106
|
+
|
107
|
+
return self
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
####################
|
112
|
+
# before_include #
|
113
|
+
####################
|
114
|
+
|
115
|
+
###
|
116
|
+
# Create before-include event hook.
|
117
|
+
#
|
118
|
+
# @overload before_include( context, ... )
|
119
|
+
#
|
120
|
+
# @param context Optional context for which hook should be active: :any, :module, :class.
|
121
|
+
#
|
122
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy]
|
123
|
+
#
|
124
|
+
def before_include( *contexts, & block )
|
125
|
+
|
126
|
+
hook_controller = @instance_controller.before_include_controller
|
127
|
+
|
128
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
129
|
+
|
130
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
131
|
+
|
132
|
+
if block_given?
|
133
|
+
chain_proxy_instance.action( & block )
|
134
|
+
end
|
135
|
+
|
136
|
+
return chain_proxy_instance
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
###################
|
141
|
+
# after_include #
|
142
|
+
###################
|
143
|
+
|
144
|
+
###
|
145
|
+
# Create after-include event hook.
|
146
|
+
#
|
147
|
+
# @overload before_include( context, ... )
|
148
|
+
#
|
149
|
+
# @param context Optional context for which hook should be active: :any, :module, :class.
|
150
|
+
#
|
151
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy]
|
152
|
+
#
|
153
|
+
def after_include( *contexts, & block )
|
154
|
+
|
155
|
+
hook_controller = @instance_controller.after_include_controller
|
156
|
+
|
157
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
158
|
+
|
159
|
+
if block_given?
|
160
|
+
hook_controller.action( & block )
|
161
|
+
end
|
162
|
+
|
163
|
+
return hook_controller.chain_proxy.cluster_name( @name ).context( *contexts )
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
###################
|
168
|
+
# before_extend #
|
169
|
+
###################
|
170
|
+
|
171
|
+
###
|
172
|
+
# Create before-extend event hook.
|
173
|
+
#
|
174
|
+
# @overload before_include( context, ... )
|
175
|
+
#
|
176
|
+
# @param context Optional context for which hook should be active: :any, :module, :class, :instance.
|
177
|
+
#
|
178
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy]
|
179
|
+
#
|
180
|
+
def before_extend( *contexts, & block )
|
181
|
+
|
182
|
+
hook_controller = @instance_controller.before_extend_controller
|
183
|
+
|
184
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
185
|
+
|
186
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
187
|
+
|
188
|
+
if block_given?
|
189
|
+
chain_proxy_instance.action( & block )
|
190
|
+
end
|
191
|
+
|
192
|
+
return chain_proxy_instance
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
##################
|
197
|
+
# after_extend #
|
198
|
+
##################
|
199
|
+
|
200
|
+
###
|
201
|
+
# Create after-extend event hook.
|
202
|
+
#
|
203
|
+
# @overload before_include( context, ... )
|
204
|
+
#
|
205
|
+
# @param context Optional context for which hook should be active: :any, :module, :class, :instance.
|
206
|
+
#
|
207
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy]
|
208
|
+
#
|
209
|
+
def after_extend( *contexts, & block )
|
210
|
+
|
211
|
+
hook_controller = @instance_controller.after_extend_controller
|
212
|
+
|
213
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
214
|
+
|
215
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
216
|
+
|
217
|
+
if block_given?
|
218
|
+
chain_proxy_instance.action( & block )
|
219
|
+
end
|
220
|
+
|
221
|
+
return chain_proxy_instance
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
##############
|
226
|
+
# subclass #
|
227
|
+
##############
|
228
|
+
|
229
|
+
###
|
230
|
+
# Create subclass event hook.
|
231
|
+
#
|
232
|
+
# @overload subclass
|
233
|
+
#
|
234
|
+
# @return [Module::Cluster::InstanceController::HookController::ChainProxy]
|
235
|
+
#
|
236
|
+
def subclass( *contexts, & block )
|
237
|
+
|
238
|
+
# contexts parameter included for compatibility with multiple-hook-controller proxy
|
239
|
+
|
240
|
+
hook_controller = @instance_controller.subclass_controller
|
241
|
+
|
242
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
243
|
+
|
244
|
+
chain_proxy_instance.cluster_name( @name )
|
245
|
+
|
246
|
+
if block_given?
|
247
|
+
chain_proxy_instance.action( & block )
|
248
|
+
end
|
249
|
+
|
250
|
+
return chain_proxy_instance
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
##############################
|
255
|
+
# before_include_or_extend #
|
256
|
+
# before_extend_or_include #
|
257
|
+
##############################
|
258
|
+
|
259
|
+
###
|
260
|
+
# Create before-include and before-extend event hooks.
|
261
|
+
#
|
262
|
+
# @overload before_include( context, ... )
|
263
|
+
#
|
264
|
+
# @param context Optional context for which hook should be active: :any, :module, :class, :instance.
|
265
|
+
#
|
266
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy]
|
267
|
+
#
|
268
|
+
def before_include_or_extend( *contexts, & block )
|
269
|
+
|
270
|
+
hook_controller = @instance_controller.before_include_extend_proxy
|
271
|
+
|
272
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
273
|
+
|
274
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
275
|
+
|
276
|
+
if block_given?
|
277
|
+
chain_proxy_instance.action( & block )
|
278
|
+
end
|
279
|
+
|
280
|
+
return chain_proxy_instance
|
281
|
+
|
282
|
+
end
|
283
|
+
|
284
|
+
alias_method :before_extend_or_include, :before_include_or_extend
|
285
|
+
|
286
|
+
#############################
|
287
|
+
# after_include_or_extend #
|
288
|
+
# after_extend_or_include #
|
289
|
+
#############################
|
290
|
+
|
291
|
+
###
|
292
|
+
# Create after-include and after-extend event hooks.
|
293
|
+
#
|
294
|
+
# @overload before_include( context, ... )
|
295
|
+
#
|
296
|
+
# @param context Optional context for which hook should be active: :any, :module, :class, :instance.
|
297
|
+
#
|
298
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy]
|
299
|
+
#
|
300
|
+
def after_include_or_extend( *contexts, & block )
|
301
|
+
|
302
|
+
hook_controller = @instance_controller.after_include_extend_proxy
|
303
|
+
|
304
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
305
|
+
|
306
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
307
|
+
|
308
|
+
if block_given?
|
309
|
+
chain_proxy_instance.action( & block )
|
310
|
+
end
|
311
|
+
|
312
|
+
return chain_proxy_instance
|
313
|
+
|
314
|
+
end
|
315
|
+
|
316
|
+
alias_method :after_extend_or_include, :after_include_or_extend
|
317
|
+
|
318
|
+
################################
|
319
|
+
# before_include_or_subclass #
|
320
|
+
# before_subclass_or_include #
|
321
|
+
################################
|
322
|
+
|
323
|
+
###
|
324
|
+
# Create before-include and subclass event hooks.
|
325
|
+
#
|
326
|
+
# @overload before_include( context, ... )
|
327
|
+
#
|
328
|
+
# @param context Optional context for which hook should be active: :any, :module, :class.
|
329
|
+
#
|
330
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy]
|
331
|
+
#
|
332
|
+
def before_include_or_subclass( *contexts, & block )
|
333
|
+
|
334
|
+
hook_controller = @instance_controller.before_include_subclass_proxy
|
335
|
+
|
336
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
337
|
+
|
338
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
339
|
+
|
340
|
+
if block_given?
|
341
|
+
chain_proxy_instance.action( & block )
|
342
|
+
end
|
343
|
+
|
344
|
+
return chain_proxy_instance
|
345
|
+
|
346
|
+
end
|
347
|
+
|
348
|
+
alias_method :before_subclass_or_include, :before_include_or_subclass
|
349
|
+
|
350
|
+
###############################
|
351
|
+
# after_include_or_subclass #
|
352
|
+
# after_subclass_or_include #
|
353
|
+
###############################
|
354
|
+
|
355
|
+
###
|
356
|
+
# Create after-include and subclass event hooks.
|
357
|
+
#
|
358
|
+
# @overload before_include( context, ... )
|
359
|
+
#
|
360
|
+
# @param context Optional context for which hook should be active: :any, :module, :class.
|
361
|
+
#
|
362
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy]
|
363
|
+
#
|
364
|
+
def after_include_or_subclass( *contexts, & block )
|
365
|
+
|
366
|
+
hook_controller = @instance_controller.after_include_subclass_proxy
|
367
|
+
|
368
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
369
|
+
|
370
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
371
|
+
|
372
|
+
if block_given?
|
373
|
+
chain_proxy_instance.action( & block )
|
374
|
+
end
|
375
|
+
|
376
|
+
return chain_proxy_instance
|
377
|
+
|
378
|
+
end
|
379
|
+
|
380
|
+
alias_method :after_subclass_or_include, :after_include_or_subclass
|
381
|
+
|
382
|
+
###############################
|
383
|
+
# before_extend_or_subclass #
|
384
|
+
# before_subclass_or_extend #
|
385
|
+
###############################
|
386
|
+
|
387
|
+
###
|
388
|
+
# Create before-extend and subclass event hooks.
|
389
|
+
#
|
390
|
+
# @overload before_include( context, ... )
|
391
|
+
#
|
392
|
+
# @param context Optional context for which hook should be active: :any, :module, :class, :instance.
|
393
|
+
#
|
394
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy]
|
395
|
+
#
|
396
|
+
def before_extend_or_subclass( *contexts, & block )
|
397
|
+
|
398
|
+
hook_controller = @instance_controller.before_extend_subclass_proxy
|
399
|
+
|
400
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
401
|
+
|
402
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
403
|
+
|
404
|
+
if block_given?
|
405
|
+
chain_proxy_instance.action( & block )
|
406
|
+
end
|
407
|
+
|
408
|
+
return chain_proxy_instance
|
409
|
+
|
410
|
+
end
|
411
|
+
|
412
|
+
alias_method :before_subclass_or_extend, :before_extend_or_subclass
|
413
|
+
|
414
|
+
##############################
|
415
|
+
# after_extend_or_subclass #
|
416
|
+
# after_subclass_or_extend #
|
417
|
+
##############################
|
418
|
+
|
419
|
+
###
|
420
|
+
# Create after-extend and subclass event hooks.
|
421
|
+
#
|
422
|
+
# @overload before_include( context, ... )
|
423
|
+
#
|
424
|
+
# @param context Optional context for which hook should be active: :any, :module, :class, :instance.
|
425
|
+
#
|
426
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy]
|
427
|
+
#
|
428
|
+
def after_extend_or_subclass( *contexts, & block )
|
429
|
+
|
430
|
+
hook_controller = @instance_controller.after_extend_subclass_proxy
|
431
|
+
|
432
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
433
|
+
|
434
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
435
|
+
|
436
|
+
if block_given?
|
437
|
+
chain_proxy_instance.action( & block )
|
438
|
+
end
|
439
|
+
|
440
|
+
return chain_proxy_instance
|
441
|
+
|
442
|
+
end
|
443
|
+
|
444
|
+
alias_method :after_subclass_or_extend, :after_extend_or_subclass
|
445
|
+
|
446
|
+
##########################################
|
447
|
+
# before_include_or_extend_or_subclass #
|
448
|
+
# before_include_or_subclass_or_extend #
|
449
|
+
# before_extend_or_include_or_subclass #
|
450
|
+
# before_extend_or_subclass_or_include #
|
451
|
+
# before_subclass_or_include_or_extend #
|
452
|
+
# before_subclass_or_extend_or_include #
|
453
|
+
##########################################
|
454
|
+
|
455
|
+
###
|
456
|
+
# Create before-include and before-extend and subclass event hooks.
|
457
|
+
#
|
458
|
+
# @overload before_include( context, ... )
|
459
|
+
#
|
460
|
+
# @param context Optional context for which hook should be active: :any, :module, :class, :instance.
|
461
|
+
#
|
462
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy]
|
463
|
+
#
|
464
|
+
def before_include_or_extend_or_subclass( *contexts, & block )
|
465
|
+
|
466
|
+
hook_controller = @instance_controller.before_include_extend_subclass_proxy
|
467
|
+
|
468
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
469
|
+
|
470
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
471
|
+
|
472
|
+
if block_given?
|
473
|
+
chain_proxy_instance.action( & block )
|
474
|
+
end
|
475
|
+
|
476
|
+
return chain_proxy_instance
|
477
|
+
|
478
|
+
end
|
479
|
+
|
480
|
+
alias_method :before_include_or_subclass_or_extend, :before_include_or_extend_or_subclass
|
481
|
+
alias_method :before_extend_or_include_or_subclass, :before_include_or_extend_or_subclass
|
482
|
+
alias_method :before_extend_or_subclass_or_include, :before_include_or_extend_or_subclass
|
483
|
+
alias_method :before_subclass_or_include_or_extend, :before_include_or_extend_or_subclass
|
484
|
+
alias_method :before_subclass_or_extend_or_include, :before_include_or_extend_or_subclass
|
485
|
+
|
486
|
+
#########################################
|
487
|
+
# after_include_or_extend_or_subclass #
|
488
|
+
# after_include_or_subclass_or_extend #
|
489
|
+
# after_extend_or_include_or_subclass #
|
490
|
+
# after_extend_or_subclass_or_include #
|
491
|
+
# after_subclass_or_include_or_extend #
|
492
|
+
# after_subclass_or_extend_or_include #
|
493
|
+
#########################################
|
494
|
+
|
495
|
+
###
|
496
|
+
# Create after-include and after-extend and subclass event hooks.
|
497
|
+
#
|
498
|
+
# @overload before_include( context, ... )
|
499
|
+
#
|
500
|
+
# @param context Optional context for which hook should be active: :any, :module, :class, :instance.
|
501
|
+
#
|
502
|
+
# @return [Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy]
|
503
|
+
#
|
504
|
+
def after_include_or_extend_or_subclass( *contexts, & block )
|
505
|
+
|
506
|
+
hook_controller = @instance_controller.after_include_extend_subclass_proxy
|
507
|
+
|
508
|
+
chain_proxy_instance = hook_controller.chain_proxy
|
509
|
+
|
510
|
+
chain_proxy_instance.cluster_name( @name ).context( *contexts )
|
511
|
+
|
512
|
+
if block_given?
|
513
|
+
chain_proxy_instance.action( & block )
|
514
|
+
end
|
515
|
+
|
516
|
+
return chain_proxy_instance
|
517
|
+
|
518
|
+
end
|
519
|
+
|
520
|
+
alias_method :after_include_or_subclass_or_extend, :after_include_or_extend_or_subclass
|
521
|
+
alias_method :after_extend_or_include_or_subclass, :after_include_or_extend_or_subclass
|
522
|
+
alias_method :after_extend_or_subclass_or_include, :after_include_or_extend_or_subclass
|
523
|
+
alias_method :after_subclass_or_include_or_extend, :after_include_or_extend_or_subclass
|
524
|
+
alias_method :after_subclass_or_extend_or_include, :after_include_or_extend_or_subclass
|
525
|
+
|
526
|
+
##################################################################################################
|
527
|
+
# private ######################################################################################
|
528
|
+
##################################################################################################
|
529
|
+
|
530
|
+
###
|
531
|
+
# These methods are not actually in private space but are internal methods for inter-object
|
532
|
+
# communications. They aren't intended for public interfacing.
|
533
|
+
#
|
534
|
+
|
535
|
+
##############
|
536
|
+
# instance #
|
537
|
+
##############
|
538
|
+
|
539
|
+
###
|
540
|
+
# @private
|
541
|
+
#
|
542
|
+
# Instance for which cluster is operative.
|
543
|
+
#
|
544
|
+
# @!attribute [reader] Instance.
|
545
|
+
#
|
546
|
+
# @return [Object] Instance.
|
547
|
+
#
|
548
|
+
attr_reader :instance
|
549
|
+
|
550
|
+
end
|