module-cluster 1.3.7 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/README.md +146 -1
  2. data/README.rdoc +146 -1
  3. data/lib/module-cluster.rb +54 -12
  4. data/lib/module-cluster/ModuleCluster/Define/Block.rb +3 -0
  5. data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +16 -4
  6. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +63 -0
  7. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +2 -0
  8. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +63 -0
  9. data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +32 -0
  10. data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +16 -4
  11. data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +63 -0
  12. data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +200 -0
  13. data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +127 -0
  14. data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +7 -19
  15. data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +5 -20
  16. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +9 -26
  17. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +9 -26
  18. data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +46 -0
  19. data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +200 -0
  20. data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +208 -0
  21. data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +127 -0
  22. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +54 -0
  23. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +44 -0
  24. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +209 -0
  25. data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ClusterStack.rb +0 -2
  26. data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ClusterStack/Block.rb +1 -2
  27. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +36 -0
  28. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +20 -0
  29. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +36 -0
  30. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +2 -0
  31. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +108 -0
  32. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +84 -0
  33. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +108 -0
  34. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +84 -0
  35. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +7 -0
  36. data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ExtendForCascade.rb +0 -0
  37. data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +230 -0
  38. data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +238 -0
  39. data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +231 -0
  40. data/spec/ModuleCluster/Define/Block/Class_spec.rb +224 -0
  41. data/spec/ModuleCluster/Define/Block/Instance_spec.rb +78 -0
  42. data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +54 -0
  43. data/spec/ModuleCluster/Define/Block/Module_spec.rb +224 -0
  44. data/spec/ModuleCluster/Define/Block_spec.rb +18 -0
  45. data/spec/ModuleCluster/Define/ClassCluster_spec.rb +728 -0
  46. data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +576 -0
  47. data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +298 -60
  48. data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +307 -61
  49. data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +335 -36
  50. data/spec/ModuleCluster/Define/Cluster_spec.rb +447 -14
  51. data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +102 -0
  52. data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +728 -0
  53. data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +728 -0
  54. data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +576 -0
  55. data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +278 -0
  56. metadata +42 -13
  57. data/lib/module-cluster/ModuleCluster/CascadeFeatures.rb +0 -197
  58. data/lib/module-cluster/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
  59. data/lib/module-cluster/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
  60. data/lib/module-cluster/ModuleCluster/ClusterStack/Extends.rb +0 -29
  61. data/lib/module-cluster/ModuleCluster/ClusterStack/Includes.rb +0 -28
  62. data/lib/module-cluster/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -28
  63. data/lib/module-cluster/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -28
  64. data/lib/module-cluster/ModuleCluster/Define/ClusterStack.rb +0 -26
@@ -0,0 +1,54 @@
1
+
2
+ module ModuleCluster::CascadeFeatures
3
+
4
+ extend ModuleCluster::CascadeFeatures::PerformCascades
5
+
6
+ #####################
7
+ # append_features #
8
+ #####################
9
+
10
+ def append_features( hooked_instance )
11
+
12
+ ModuleCluster::CascadeFeatures.cascade_features( self, hooked_instance, cluster_stack.prepending_include_hooks )
13
+
14
+ super
15
+
16
+ end
17
+
18
+ ##############
19
+ # included #
20
+ ##############
21
+
22
+ def included( hooked_instance )
23
+
24
+ super
25
+
26
+ ModuleCluster::CascadeFeatures.cascade_features( self, hooked_instance, cluster_stack.include_hooks )
27
+
28
+ end
29
+
30
+ ###################
31
+ # extend_object #
32
+ ###################
33
+
34
+ def extend_object( hooked_instance )
35
+
36
+ ModuleCluster::CascadeFeatures.cascade_features( self, hooked_instance, cluster_stack.prepending_extend_hooks )
37
+
38
+ super
39
+
40
+ end
41
+
42
+ ##############
43
+ # extended #
44
+ ##############
45
+
46
+ def extended( hooked_instance )
47
+
48
+ super
49
+
50
+ ModuleCluster::CascadeFeatures.cascade_features( self, hooked_instance, cluster_stack.extend_hooks )
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,44 @@
1
+
2
+ module ModuleCluster::CascadeFeatures::ClusterStack
3
+
4
+ #########################
5
+ # self.cluster_stacks #
6
+ #########################
7
+
8
+ def self.cluster_stacks
9
+
10
+ return @cluster_stacks ||= Hash.new
11
+
12
+ end
13
+
14
+ ########################
15
+ # self.cluster_stack #
16
+ ########################
17
+
18
+ def self.cluster_stack( class_or_module )
19
+
20
+ cluster_stack_for_class_or_module = nil
21
+
22
+ unless cluster_stack_for_class_or_module = cluster_stacks[ class_or_module ]
23
+
24
+ cluster_stack_for_class_or_module = ModuleCluster::ClusterStack.new
25
+
26
+ cluster_stacks[ class_or_module ] = cluster_stack_for_class_or_module
27
+
28
+ end
29
+
30
+ return cluster_stack_for_class_or_module
31
+
32
+ end
33
+
34
+ ###################
35
+ # cluster_stack #
36
+ ###################
37
+
38
+ def cluster_stack
39
+
40
+ return ModuleCluster::CascadeFeatures::ClusterStack.cluster_stack( self )
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,209 @@
1
+
2
+ module ModuleCluster::CascadeFeatures::PerformCascades
3
+
4
+ ######################
5
+ # cascade_features #
6
+ ######################
7
+
8
+ def cascade_features( module_self, hooked_instance, set_stack )
9
+
10
+ # This method is called when a ModuleCluster module is included or extended.
11
+ # It determines what modules should be included/extended and which should cascade.
12
+
13
+ # for each set:
14
+ set_stack.each do |this_set|
15
+
16
+ # Block sets simply run a block at a hook. They do not include or extend returns from the block.
17
+ # The hooked module will not be extended by ModuleCluster.
18
+ if this_set.is_a?( ModuleCluster::ClusterStack::Block::Set )
19
+
20
+ if this_set.dependency_module.should_run_block?( hooked_instance )
21
+
22
+ case this_set.runtime_block.arity
23
+ when 0
24
+ module_self.instance_eval( & this_set.runtime_block )
25
+ else
26
+ module_self.instance_exec( hooked_instance, & this_set.runtime_block )
27
+ end
28
+
29
+ end
30
+
31
+ # Other sets take parameters and an optional block. The optional block returns are included
32
+ # or extended like the parameters provided.
33
+ else
34
+
35
+ # dependency modules can cause instances to be included/extended and/or cascade
36
+ should_include = this_set.dependency_module.should_include_or_extend?( hooked_instance )
37
+ should_cascade = this_set.dependency_module.should_cascade?( hooked_instance )
38
+
39
+ # cascade parameter modules as appropriate
40
+ cascade_modules_into_hooked_instance( module_self, hooked_instance, this_set, this_set.modules ) if should_cascade
41
+
42
+ # include/extend parameter modules as appropriate
43
+ include_extend_modules( module_self, hooked_instance, this_set, this_set.modules ) if should_include
44
+
45
+ # process runtime block if present
46
+ if this_set.runtime_includes_or_extends_block
47
+
48
+ # if we have a runtime block, run block and collect returns as appropriate
49
+ if runtime_modules = collect_block_runtime_result_modules( module_self, hooked_instance, this_set )
50
+
51
+ # cascade return modules if appropriate
52
+ cascade_modules_into_hooked_instance( module_self, hooked_instance, this_set, runtime_modules ) if should_cascade
53
+
54
+ # include/extend return modules if appropriate
55
+ include_extend_modules( module_self, hooked_instance, this_set, runtime_modules ) if should_include
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
67
+ ############################
68
+ # include_extend_modules #
69
+ ############################
70
+
71
+ def include_extend_modules( module_self, hooked_instance, set, modules )
72
+
73
+ # Collect include/extend modules from this set into our eventual include/extend order.
74
+ case set.include_or_extend
75
+ when :include_and_extend
76
+ include_or_extend_hooked_instance( hooked_instance, set, true, true, modules )
77
+ when :include
78
+ include_or_extend_hooked_instance( hooked_instance, set, true, false, modules )
79
+ when :extend
80
+ include_or_extend_hooked_instance( hooked_instance, set, false, true, modules )
81
+ end
82
+
83
+ end
84
+
85
+ ##########################################
86
+ # cascade_modules_into_hooked_instance #
87
+ ##########################################
88
+
89
+ def cascade_modules_into_hooked_instance( module_self, hooked_instance, set, modules )
90
+
91
+ # if we are supposed to cascade we need to extend with the ModuleCluster dependency module
92
+ hooked_instance.extend( set.dependency_module )
93
+
94
+ # and we call the set's definition method to cascade
95
+ hooked_instance.__send__( set.method, *modules )
96
+
97
+ end
98
+
99
+ #######################################
100
+ # include_or_extend_hooked_instance #
101
+ ######################################
102
+
103
+ def include_or_extend_hooked_instance( hooked_instance, set, should_include, should_extend, modules )
104
+
105
+ # We have collected includes, extends, transparent cascades.
106
+ # Now we want to actually include/extend/cascade as appropriate.
107
+
108
+ # If we have a module (a class is a module):
109
+ module_self = self
110
+ if hooked_instance.is_a?( Module )
111
+
112
+ hooked_instance.module_eval do
113
+
114
+ if should_include and
115
+ module_self.should_include_or_extend_instance?( set.module_class_instance_or_all, hooked_instance ) and
116
+ ! modules.empty?
117
+
118
+ include( *modules.reverse )
119
+
120
+ end
121
+
122
+ if should_extend and
123
+ module_self.should_include_or_extend_instance?( set.module_class_instance_or_all, hooked_instance ) and
124
+ ! modules.empty?
125
+
126
+ extend( *modules.reverse )
127
+
128
+ end
129
+
130
+ end
131
+
132
+ # Otherwise we have an instance:
133
+ else
134
+
135
+ if should_extend and
136
+ module_self.should_include_or_extend_instance?( set.module_class_instance_or_all, hooked_instance ) and
137
+ ! modules.empty?
138
+
139
+ hooked_instance.extend( *modules.reverse )
140
+
141
+ end
142
+
143
+ end
144
+
145
+ end
146
+
147
+ ########################################
148
+ # should_include_or_extend_instance? #
149
+ ########################################
150
+
151
+ def should_include_or_extend_instance?( module_class_instance_or_all, into_instance )
152
+
153
+ # The set stack already corresponds to include or extend or both, we are testing all_module_class_or_instance for:
154
+ #
155
+ # * any include/extend
156
+ # * module include/extend
157
+ # * class include/extend
158
+ # * instance extend
159
+
160
+ should_include_or_extend_instance = false
161
+
162
+ if module_class_instance_or_all == :all or
163
+ module_class_instance_or_all == :module && ( into_instance.is_a?( Module ) && ! into_instance.is_a?( Class ) ) or
164
+ module_class_instance_or_all == :class && into_instance.is_a?( Class ) or
165
+ module_class_instance_or_all == :instance && ! into_instance.is_a?( Module )
166
+
167
+ should_include_or_extend_instance = true
168
+
169
+ end
170
+
171
+ return should_include_or_extend_instance
172
+
173
+ end
174
+
175
+ ##########################################
176
+ # collect_block_runtime_result_modules #
177
+ ##########################################
178
+
179
+ def collect_block_runtime_result_modules( module_self, hooked_instance, set )
180
+
181
+ runtime_block_result_modules = nil
182
+
183
+ case set.runtime_includes_or_extends_block.arity
184
+ when 0
185
+ runtime_block_result_modules = module_self.instance_eval( & set.runtime_includes_or_extends_block )
186
+ else
187
+ runtime_block_result_modules = module_self.instance_exec( hooked_instance, & set.runtime_includes_or_extends_block )
188
+ end
189
+
190
+ if runtime_block_result_modules
191
+
192
+ # make sure we have an array as a result
193
+ runtime_block_result_modules = [ runtime_block_result_modules ] unless runtime_block_result_modules.is_a?( Array )
194
+
195
+ # make sure members of our result array are modules
196
+ runtime_block_result_modules.delete_if do |this_result_instance|
197
+ ! this_result_instance.is_a?( Module )
198
+ end
199
+
200
+
201
+ runtime_block_result_modules = nil if runtime_block_result_modules.empty?
202
+
203
+ end
204
+
205
+ return runtime_block_result_modules
206
+
207
+ end
208
+
209
+ end
@@ -1,8 +1,6 @@
1
1
 
2
2
  class ModuleCluster::ClusterStack
3
3
 
4
- Set = Struct.new( :dependency_module, :method, :include_or_extend, :modules, :runtime_includes_or_extends_block )
5
-
6
4
  include ModuleCluster::ClusterStack::Block
7
5
  include ModuleCluster::ClusterStack::Includes
8
6
  include ModuleCluster::ClusterStack::Extends
@@ -1,9 +1,8 @@
1
1
 
2
2
  module ModuleCluster::ClusterStack::Block
3
3
 
4
- Set = Struct.new( :runtime_block )
5
-
6
4
  include ModuleCluster::ClusterStack::Block::Class
7
5
  include ModuleCluster::ClusterStack::Block::Module
6
+ include ModuleCluster::ClusterStack::Block::Instance
8
7
 
9
8
  end
@@ -0,0 +1,36 @@
1
+
2
+ module ModuleCluster::ClusterStack::Block::Class
3
+
4
+ ###################
5
+ # class_include #
6
+ ###################
7
+
8
+ def class_include( dependency_module, runtime_block )
9
+ include_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
10
+ end
11
+
12
+ ##################
13
+ # class_extend #
14
+ ##################
15
+
16
+ def class_extend( dependency_module, runtime_block )
17
+ extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
18
+ end
19
+
20
+ ###########################
21
+ # prepend_class_include #
22
+ ###########################
23
+
24
+ def prepend_class_include( dependency_module, runtime_block )
25
+ prepending_include_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
26
+ end
27
+
28
+ ##########################
29
+ # prepend_class_extend #
30
+ ##########################
31
+
32
+ def prepend_class_extend( dependency_module, runtime_block )
33
+ prepending_extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
34
+ end
35
+
36
+ end
@@ -0,0 +1,20 @@
1
+
2
+ module ModuleCluster::ClusterStack::Block::Instance
3
+
4
+ #####################
5
+ # instance_extend #
6
+ #####################
7
+
8
+ def instance_extend( dependency_module, runtime_block )
9
+ extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
10
+ end
11
+
12
+ #############################
13
+ # prepend_instance_extend #
14
+ #############################
15
+
16
+ def prepend_instance_extend( dependency_module, runtime_block )
17
+ prepending_extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
18
+ end
19
+
20
+ end
@@ -0,0 +1,36 @@
1
+
2
+ module ModuleCluster::ClusterStack::Block::Module
3
+
4
+ ####################
5
+ # module_include #
6
+ ####################
7
+
8
+ def module_include( dependency_module, runtime_block )
9
+ include_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
10
+ end
11
+
12
+ ###################
13
+ # module_extend #
14
+ ###################
15
+
16
+ def module_extend( dependency_module, runtime_block )
17
+ extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
18
+ end
19
+
20
+ ############################
21
+ # prepend_module_include #
22
+ ############################
23
+
24
+ def prepend_module_include( dependency_module, runtime_block )
25
+ prepending_include_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
26
+ end
27
+
28
+ ###########################
29
+ # prepend_module_extend #
30
+ ###########################
31
+
32
+ def prepend_module_extend( dependency_module, runtime_block )
33
+ prepending_extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
34
+ end
35
+
36
+ end
@@ -0,0 +1,2 @@
1
+
2
+ ModuleCluster::ClusterStack::Block::Set = Struct.new( :dependency_module, :runtime_block )
@@ -0,0 +1,108 @@
1
+
2
+ module ModuleCluster::ClusterStack::Extends
3
+
4
+ ##################
5
+ # extend_hooks #
6
+ ##################
7
+
8
+ def extend_hooks
9
+ return @extend_hooks ||= Array.new
10
+ end
11
+
12
+ #####################
13
+ # extend_includes #
14
+ #####################
15
+
16
+ def extend_includes( module_instance, method, includes, runtime_includes_block )
17
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include, includes, runtime_includes_block ) )
18
+ end
19
+
20
+ ####################
21
+ # extend_extends #
22
+ ####################
23
+
24
+ def extend_extends( module_instance, method, extends, runtime_extends_block )
25
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :extend, extends, runtime_extends_block ) )
26
+ end
27
+
28
+ #################################
29
+ # extend_includes_and_extends #
30
+ #################################
31
+
32
+ def extend_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
33
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block ) )
34
+ end
35
+
36
+ ############################
37
+ # module_extend_includes #
38
+ ############################
39
+
40
+ def module_extend_includes( module_instance, method, includes, runtime_includes_block )
41
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include, includes, runtime_includes_block ) )
42
+ end
43
+
44
+ ###########################
45
+ # module_extend_extends #
46
+ ###########################
47
+
48
+ def module_extend_extends( module_instance, method, extends, runtime_extends_block )
49
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :extend, extends, runtime_extends_block ) )
50
+ end
51
+
52
+ ########################################
53
+ # module_extend_includes_and_extends #
54
+ ########################################
55
+
56
+ def module_extend_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
57
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block ) )
58
+ end
59
+
60
+ ###########################
61
+ # class_extend_includes #
62
+ ###########################
63
+
64
+ def class_extend_includes( module_instance, method, includes, runtime_includes_block )
65
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include, includes, runtime_includes_block ) )
66
+ end
67
+
68
+ ##########################
69
+ # class_extend_extends #
70
+ ##########################
71
+
72
+ def class_extend_extends( module_instance, method, extends, runtime_extends_block )
73
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :extend, extends, runtime_extends_block ) )
74
+ end
75
+
76
+ #######################################
77
+ # class_extend_includes_and_extends #
78
+ #######################################
79
+
80
+ def class_extend_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
81
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block ) )
82
+ end
83
+
84
+ ##############################
85
+ # instance_extend_includes #
86
+ ##############################
87
+
88
+ def instance_extend_includes( module_instance, method, includes, runtime_includes_block )
89
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :include, includes, runtime_includes_block ) )
90
+ end
91
+
92
+ #############################
93
+ # instance_extend_extends #
94
+ #############################
95
+
96
+ def instance_extend_extends( module_instance, method, extends, runtime_extends_block )
97
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :extend, extends, runtime_extends_block ) )
98
+ end
99
+
100
+ ##########################################
101
+ # instance_extend_includes_and_extends #
102
+ ##########################################
103
+
104
+ def instance_extend_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
105
+ extend_hooks.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block ) )
106
+ end
107
+
108
+ end