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
data/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  http://rubygems.org/gems/module-cluster
4
4
 
5
- # Description #
5
+ # Summary #
6
6
 
7
- Adds methods for defining module clusters using #included, #extended, #append_features, and #extend_object.
7
+ Provides an interface for event hooks at any point during module include/extend or class subclassing.
8
8
 
9
- # Summary #
9
+ # Description #
10
10
 
11
- Provides methods for clustering modules so that when the main module is included other modules are also included or extended, either before or after the main module. There are currently three variants: cluster, cascade, cascade to class. Cluster causes the next module to be affected. Cascade causes all subsequent modules to be affected. Cascade to class causes the first including/extending class to be affected, but not any modules prior to it (although the effects will cascade through those unaffected modules).
11
+ Provides hooks via :included, :extended, :append_features, :extend_object, :subclass. Define behavior at hooks via simple interface.
12
12
 
13
13
  # Install #
14
14
 
@@ -16,374 +16,164 @@ Provides methods for clustering modules so that when the main module is included
16
16
 
17
17
  # Usage #
18
18
 
19
- Simply:
19
+ Extend the module that you want to enable:
20
20
 
21
21
  ```ruby
22
22
  module SomeModule
23
- extend ::ModuleCluster
23
+ extend Module::Cluster
24
24
  end
25
25
  ```
26
26
 
27
- Definition methods accept modules as arguments.
27
+ ## Basic Hooks ##
28
+
29
+ Hooks are defined on named clusters, that way they can be enabled/disabled later on.
30
+
31
+ There are four type of module hooks:
32
+
33
+ * before_include
34
+ * after_include
35
+ * before_extend
36
+ * after_extend
28
37
 
29
- For example:
38
+ There are also subclass hooks:
39
+
40
+ * subclass
41
+
42
+ Any of these hooks can be defined on a cluster:
30
43
 
31
44
  ```ruby
32
45
  module SomeModule
33
- extend ::ModuleCluster
34
- include_also_includes( SomeOtherModule )
46
+ # Create a hook to be activated before this module is included
47
+ cluster( :some_cluster_name ).before_include
35
48
  end
36
49
  ```
37
50
 
38
- Additionally, all methods accept a block that returns one or more modules; the modules will be added *after* any modules specified in the parameters:
51
+ Then declarations can be made by chaining calls.
52
+
53
+ ### Block Hooks ###
39
54
 
40
55
  ```ruby
41
- module SomeModule
42
- extend ::ModuleCluster
43
- include_also_includes( SomeOtherModule ) do
44
- AnotherModule
56
+ module SomeModule
57
+ cluster( :some_cluster_name ).before_include do |hooked_instance|
58
+ # some stuff
45
59
  end
46
60
  end
47
61
  ```
48
62
 
49
- Blocks can be used to return dynamically-determined modules at runtime.
63
+ The block passed to :before_include will be run when SomeModule is included in another module.
64
+
65
+ ### Include/Extend Hooks ###
66
+
67
+ ```ruby
68
+ # Some other module we want to extend at include time
69
+ module AnotherModule
70
+ end
71
+
72
+ module SomeModule
73
+ cluster( :some_cluster_name ).before_include.extend( AnotherModule )
74
+ end
75
+ ```
76
+
77
+ Now if SomeModule is included, the module in which it is included will also be extended by AnotherModule.
78
+
79
+ What if we only want to extend classes but not modules?
80
+
81
+ ```ruby
82
+ # Some other module we want to extend at include time
83
+ module AnotherModule
84
+ end
85
+
86
+ module SomeModule
87
+ cluster( :some_cluster_name ).before_include( :class ).extend( AnotherModule )
88
+ end
89
+ ```
90
+
91
+ The same works for :any, :class, :module, :instance.
92
+
93
+ ## Cascading Hooks ##
94
+
95
+ Sometimes we want to be able to declare that actions should happen well down the line. For instance, ModuleA should take action on the first class but might be included in any number of intermediate modules first. We can easily handle this case by declaring cascading behavior.
50
96
 
51
97
  ```ruby
98
+ # Some other module we want to extend at include time
99
+ module AnotherModule
100
+ end
101
+
52
102
  module SomeModule
53
- extend ::ModuleCluster
54
- include_or_extend_cascades_prepend_extends do
55
- method_that_returns_one_or_more_modules
56
- end
103
+ cluster( :some_cluster_name ).before_include.cascade.extend( AnotherModule )
57
104
  end
58
105
  ```
59
106
 
60
- Block methods can be used for nesting declarations, for instance to apply cascades only after first module/class:
107
+ Now any module or class that includes SomeModule or any module or class that includes that module (and so on) will be extended by AnotherModule.
108
+
109
+ If we only want certain contexts to receive the cascading functionality we can limit it the same way we limited include/extend contexts:
61
110
 
62
111
  ```ruby
63
- prepend_module_include do |class_or_module|
64
- class_or_module.include_or_extend_cascades_prepend_extends do
65
- method_that_returns_one_or_more_modules
66
- end
112
+ # Some other module we want to extend at include time
113
+ module AnotherModule
114
+ end
115
+
116
+ module SomeModule
117
+ cluster( :some_cluster_name ).before_include.cascade_to( :class ).extend( AnotherModule )
67
118
  end
68
119
  ```
69
120
 
70
- Calls to the various functions are cumulative and stack in the order called. This permits multiple calls, whether subsequently or otherwise.
71
-
72
- # Methods #
73
-
74
- Cluster methods:
75
-
76
- * include_also_includes
77
- * include_also_extends
78
- * include_also_includes_and_extends
79
- * extend_also_includes
80
- * extend_also_extends
81
- * extend_also_includes_and_extends
82
- * include_prepends_includes
83
- * include_prepends_extends
84
- * include_prepends_includes_and_extends
85
- * extend_prepends_includes
86
- * extend_prepends_extends
87
- * extend_prepends_includes_and_extends
88
- * include_or_extend_also_includes
89
- * include_or_extend_also_extends
90
- * include_or_extend_also_includes_and_extends
91
- * include_or_extend_prepends_includes
92
- * include_or_extend_prepends_extends
93
- * include_or_extend_prepends_includes_and_extends
94
-
95
- Module cluster methods:
96
-
97
- * module_include_also_includes
98
- * module_include_also_extends
99
- * module_include_also_includes_and_extends
100
- * module_extend_also_includes
101
- * module_extend_also_extends
102
- * module_extend_also_includes_and_extends
103
- * module_include_prepends_includes
104
- * module_include_prepends_extends
105
- * module_include_prepends_includes_and_extends
106
- * module_extend_prepends_includes
107
- * module_extend_prepends_extends
108
- * module_extend_prepends_includes_and_extends
109
- * module_include_or_extend_also_includes
110
- * module_include_or_extend_also_extends
111
- * module_include_or_extend_also_includes_and_extends
112
- * module_include_or_extend_prepends_includes
113
- * module_include_or_extend_prepends_extends
114
- * module_include_or_extend_prepends_includes_and_extends
115
-
116
- Class cluster methods:
117
-
118
- * class_include_also_includes
119
- * class_include_also_extends
120
- * class_include_also_includes_and_extends
121
- * class_extend_also_includes
122
- * class_extend_also_extends
123
- * class_extend_also_includes_and_extends
124
- * class_include_prepends_includes
125
- * class_include_prepends_extends
126
- * class_include_prepends_includes_and_extends
127
- * class_extend_prepends_includes
128
- * class_extend_prepends_extends
129
- * class_extend_prepends_includes_and_extends
130
- * class_include_or_extend_also_includes
131
- * class_include_or_extend_also_extends
132
- * class_include_or_extend_also_includes_and_extends
133
- * class_include_or_extend_prepends_includes
134
- * class_include_or_extend_prepends_extends
135
- * class_include_or_extend_prepends_includes_and_extends
136
-
137
- Instance cluster methods:
138
-
139
- * instance_extend_also_extends
140
- * instance_extend_prepends_extends
141
-
142
- Module or instance cluster methods:
143
-
144
- * module_include_or_extend_or_instance_extend_also_includes_or_extends
145
- * module_include_or_extend_or_instance_extend_also_extends
146
- * module_include_or_instance_extend_also_includes_or_extends
147
- * module_include_or_instance_extend_also_extends
148
- * module_or_instance_extend_also_extends
149
- * module_include_or_extend_or_instance_extend_prepends_includes_or_extends
150
- * module_include_or_instance_extend_prepends_includes_or_extends
151
- * module_include_or_extend_or_instance_extend_prepends_extends
152
- * module_include_or_instance_extend_prepends_extends
153
- * module_or_instance_extend_prepends_extends
154
-
155
- Class or module cluster methods:
156
-
157
- * module_or_class_include_also_includes
158
- * module_or_class_include_also_extends
159
- * module_or_class_include_also_includes_and_extends
160
- * module_or_class_extend_also_includes
161
- * module_or_class_extend_also_extends
162
- * module_or_class_extend_also_includes_and_extends
163
- * module_or_class_include_prepends_includes
164
- * module_or_class_include_prepends_extends
165
- * module_or_class_include_prepends_includes_and_extends
166
- * module_or_class_extend_prepends_includes
167
- * module_or_class_extend_prepends_extends
168
- * module_or_class_extend_prepends_includes_and_extends
169
- * module_or_class_include_or_extend_also_includes
170
- * module_or_class_include_or_extend_also_extends
171
- * module_or_class_include_or_extend_also_includes_and_extends
172
- * module_or_class_include_or_extend_prepends_includes
173
- * module_or_class_include_or_extend_prepends_extends
174
- * module_or_class_include_or_extend_prepends_includes_and_extends
175
-
176
- Class or module or instance cluster methods:
177
-
178
- * module_include_or_extend_or_instance_extend_also_includes_or_extends
179
- * module_include_or_extend_or_instance_extend_also_extends
180
- * module_include_or_instance_extend_also_includes_or_extends
181
- * module_include_or_instance_extend_also_extends
182
- * module_or_instance_extend_also_extends
183
- * module_include_or_extend_or_instance_extend_prepends_includes_or_extends
184
- * module_include_or_instance_extend_prepends_includes_or_extends
185
- * module_include_or_extend_or_instance_extend_prepends_extends
186
- * module_include_or_instance_extend_prepends_extends
187
- * module_or_instance_extend_prepends_extends
188
-
189
- Class or instance cluster methods:
190
-
191
- * class_include_or_extend_or_instance_extend_also_includes_or_extends
192
- * class_include_or_extend_or_instance_extend_also_extends
193
- * class_include_or_instance_extend_also_includes_or_extends
194
- * class_include_or_instance_extend_also_extends
195
- * class_or_instance_extend_also_extends
196
- * class_include_or_extend_or_instance_extend_prepends_includes_or_extends
197
- * class_include_or_instance_extend_prepends_includes_or_extends
198
- * class_include_or_extend_or_instance_extend_prepends_extends
199
- * class_include_or_instance_extend_prepends_extends
200
- * class_or_instance_extend_prepends_extends
201
-
202
- Cascade methods (cascades to modules and classes):
203
-
204
- * include_cascades_includes
205
- * include_cascades_extends
206
- * include_cascades_includes_and_extends
207
- * extend_cascades_includes
208
- * extend_cascades_extends
209
- * extend_cascades_includes_and_extends
210
- * include_cascades_prepend_includes
211
- * include_cascades_prepend_extends
212
- * include_cascades_prepend_includes_and_extends
213
- * extend_cascades_prepend_includes
214
- * extend_cascades_prepend_extends
215
- * extend_cascades_prepend_includes_and_extends
216
- * include_or_extend_cascades_includes
217
- * include_or_extend_cascades_extends
218
- * include_or_extend_cascades_includes_and_extends
219
- * include_or_extend_cascades_prepend_includes
220
- * include_or_extend_cascades_prepend_extends
221
- * include_or_extend_cascades_prepend_includes_and_extends
222
-
223
- Cascade to class methods (does not cascade to modules):
224
-
225
- * include_cascades_includes_to_class
226
- * include_cascades_extends_to_class
227
- * include_cascades_includes_and_extends_to_class
228
- * extend_cascades_includes_to_class
229
- * extend_cascades_extends_to_class
230
- * extend_cascades_includes_and_extends_to_class
231
- * include_cascades_to_class_prepend_includes
232
- * include_cascades_to_class_prepend_extends
233
- * include_cascades_to_class_prepend_includes_and_extends
234
- * extend_cascades_to_class_prepend_includes
235
- * extend_cascades_to_class_prepend_extends
236
- * extend_cascades_to_class_prepend_includes_and_extends
237
- * include_or_extend_cascades_includes_to_class
238
- * include_or_extend_cascades_extends_to_class
239
- * include_or_extend_cascades_includes_and_extends_to_class
240
- * include_or_extend_cascades_to_class_prepend_includes
241
- * include_or_extend_cascades_to_class_prepend_extends
242
- * include_or_extend_cascades_to_class_prepend_includes_and_extends
243
-
244
- Cascade to module methods (does not cascade to classes):
245
-
246
- * include_cascades_includes_to_module
247
- * include_cascades_extends_to_module
248
- * include_cascades_includes_and_extends_to_module
249
- * extend_cascades_includes_to_module
250
- * extend_cascades_extends_to_module
251
- * extend_cascades_includes_and_extends_to_module
252
- * include_cascades_to_module_prepend_includes
253
- * include_cascades_to_module_prepend_extends
254
- * include_cascades_to_module_prepend_includes_and_extends
255
- * extend_cascades_to_module_prepend_includes
256
- * extend_cascades_to_module_prepend_extends
257
- * extend_cascades_to_module_prepend_includes_and_extends
258
- * include_or_extend_cascades_includes_to_module
259
- * include_or_extend_cascades_extends_to_module
260
- * include_or_extend_cascades_includes_and_extends_to_module
261
- * include_or_extend_cascades_to_module_prepend_includes
262
- * include_or_extend_cascades_to_module_prepend_extends
263
- * include_or_extend_cascades_to_module_prepend_includes_and_extends
264
-
265
- Module block methods:
266
-
267
- * module_include
268
- * module_extend
269
- * module_include_or_extend
270
- * prepend_module_include
271
- * prepend_module_extend
272
- * prepend_module_include_or_extend
273
-
274
- * cascading_module_include
275
- * cascading_module_extend
276
- * cascading_module_include_or_extend
277
- * cascading_prepend_module_include
278
- * cascading_prepend_module_extend
279
- * cascading_prepend_module_include_or_extend
280
-
281
- Class block methods:
282
-
283
- * class_include
284
- * class_extend
285
- * class_include_or_extend
286
- * prepend_class_include
287
- * prepend_class_extend
288
- * prepend_class_include_or_extend
289
-
290
- * cascading_class_include
291
- * cascading_class_extend
292
- * cascading_class_include_or_extend
293
- * cascading_prepend_class_include
294
- * cascading_prepend_class_extend
295
- * cascading_prepend_class_include_or_extend
296
-
297
- Instance block methods:
298
-
299
- * instance_extend
300
- * prepend_instance_extend
301
-
302
- Class or module block methods:
303
-
304
- * class_or_module_include
305
- * class_or_module_extend
306
- * class_or_module_include_or_extend
307
- * prepend_class_or_module_include
308
- * prepend_class_or_module_extend
309
- * prepend_class_or_module_include_or_extend
310
-
311
- * cascading_class_or_module_include
312
- * cascading_class_or_module_extend
313
- * cascading_class_or_module_include_or_extend
314
- * cascading_prepend_class_or_module_include
315
- * cascading_prepend_class_or_module_extend
316
- * cascading_prepend_class_or_module_include_or_extend
317
-
318
- Module or instance block methods:
319
-
320
- * module_or_instance_extend
321
- * module_include_or_instance_extend
322
- * module_include_or_extend_or_instance_extend
323
- * prepend_module_or_instance_extend
324
- * prepend_module_include_or_instance_extend
325
- * prepend_module_include_or_extend_or_instance_extend
326
-
327
- Class or instance block methods:
328
-
329
- * class_or_instance_extend
330
- * class_include_or_instance_extend
331
- * class_include_or_extend_or_instance_extend
332
- * prepend_class_or_instance_extend
333
- * prepend_class_include_or_instance_extend
334
- * prepend_class_include_or_extend_or_instance_extend
335
-
336
- Class or module or instance block methods:
337
-
338
- * class_or_module_or_instance_extend
339
- * class_or_module_include_or_instance_extend
340
- * class_or_module_include_or_extend_or_instance_extend
341
- * prepend_class_or_module_or_instance_extend
342
- * prepend_class_or_module_include_or_instance_extend
343
- * prepend_class_or_module_include_or_extend_or_instance_extend
344
-
345
- Suspend methods:
346
-
347
- * suspend_any_hooks
348
- * suspend_any_include_hooks
349
- * suspend_any_extend_hooks
350
- * suspend_include_hooks
351
- * suspend_extend_hooks
352
- * suspend_prepend_include_hooks
353
- * suspend_prepend_extend_hooks
354
-
355
- * hooks_suspended?
356
- * all_hooks_suspended?
357
- * all_include_hooks_suspended?
358
- * all_extend_hooks_suspended?
359
- * include_hooks_suspended?
360
- * extend_hooks_suspended?
361
- * prepend_include_hooks_suspended?
362
- * prepend_extend_hooks_suspended?
363
-
364
- * resume_any_hooks
365
- * resume_any_include_hooks
366
- * resume_any_extend_hooks
367
- * resume_include_hooks
368
- * resume_extend_hooks
369
- * resume_prepend_include_hooks
370
- * resume_prepend_extend_hooks
371
-
372
- Suspend for block methods:
373
-
374
- * without_any_hooks
375
- * without_any_include_hooks
376
- * without_any_extend_hooks
377
- * without_include_hooks
378
- * without_extend_hooks
379
- * without_prepend_include_hooks
380
- * without_prepend_extend_hooks
121
+ :cascade_to is simply an alias to :cascade that is more readable when specifying contexts.
122
+
123
+ Now any module that includes SomeModule will cause the first class that includes it to be extended by AnotherModule.
124
+
125
+ # Interface Rundown #
126
+
127
+ Create a cluster to group together hooks. From the cluster declarations specify what context will cause event hooks to occur:
128
+
129
+ ## Hook Contexts ##
130
+
131
+ * :before\_include
132
+ * :after\_include
133
+ * :before\_extend
134
+ * :after\_extend
135
+ * :subclass
136
+ * :before\_include\_or\_extend
137
+ * :after\_include\_or\_extend
138
+ * :before\_include\_or\_subclass
139
+ * :after\_include\_or\_subclass
140
+ * :before\_extend\_or\_subclass
141
+ * :after\_extend\_or\_subclass
142
+ * :before\_include\_or\_extend\_or\_subclass
143
+ * :after\_include\_or\_extend\_or\_subclass
144
+
145
+ Any of these declarations will return a reference to a {::Module::Cluster::InstanceController::HookController::ChainProxy Module::Cluster::InstanceController::HookController::ChainProxy} or a {::Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy}. Both have the same interface, so you don't need to worry about the difference.
146
+
147
+ ## Hook Actions ##
148
+
149
+ From the reference returned by a hook context the following declarations can be made:
150
+
151
+ * include
152
+ * extend
153
+ * include\_and\_extend
154
+ * extend\_and\_include
155
+ * action
156
+
157
+ ## Hook Action Contexts ##
158
+
159
+ As we have shown, declarations to cause cascading behavior can also be made here:
160
+
161
+ * cascade
162
+
163
+ Also, contexts can be set so that hook order can be easily manipulated. This will cause hook events to be inserted in the stack other than at the end:
164
+
165
+ * before\_include
166
+ * after\_include
167
+ * before\_extend
168
+ * after\_extend
169
+
170
+ All of these possibilities returns a reference where hook actions can be defined, exactly the same as above. The only difference is that they will occur in the chained context, which is the context described by the chained declarations. Any time that declarations begin again from the cluster, chained declarations will reset.
381
171
 
382
172
  # License #
383
173
 
384
174
  (The MIT License)
385
175
 
386
- Copyright (c) 2011 Asher
176
+ Copyright (c) 2012 Ridiculous Power, Asher
387
177
 
388
178
  Permission is hereby granted, free of charge, to any person obtaining
389
179
  a copy of this software and associated documentation files (the