module-cluster 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +66 -29
- data/README.rdoc +66 -29
- data/lib/module-cluster.rb +18 -0
- data/lib/module-cluster/ModuleCluster.rb +2 -7
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +4 -4
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +11 -8
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +19 -12
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +19 -12
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +19 -12
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +3 -2
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +11 -8
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +19 -12
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +39 -46
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +34 -33
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +31 -42
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +53 -62
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +49 -60
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +49 -60
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +3 -4
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +39 -46
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +55 -54
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +34 -33
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +4 -4
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +64 -46
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +7 -5
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +3 -3
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +2 -2
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +2 -2
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +4 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +45 -13
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +36 -10
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +47 -15
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +38 -12
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +29 -1
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +8 -3
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +10 -10
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +18 -18
- data/spec/ModuleCluster/Define/Cluster_spec.rb +18 -18
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +2 -2
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +18 -18
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +10 -10
- data/spec/ModuleCluster_spec.rb +5 -5
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +110 -2
- metadata +2 -2
@@ -9,7 +9,7 @@ module ModuleCluster::CascadeFeatures
|
|
9
9
|
|
10
10
|
def append_features( hooked_instance )
|
11
11
|
|
12
|
-
ModuleCluster::CascadeFeatures.
|
12
|
+
ModuleCluster::CascadeFeatures.perform_cascades( self, :prepend_include, hooked_instance, cluster_stack.prepend_include_hooks )
|
13
13
|
|
14
14
|
super
|
15
15
|
|
@@ -23,7 +23,7 @@ module ModuleCluster::CascadeFeatures
|
|
23
23
|
|
24
24
|
super
|
25
25
|
|
26
|
-
ModuleCluster::CascadeFeatures.
|
26
|
+
ModuleCluster::CascadeFeatures.perform_cascades( self, :include, hooked_instance, cluster_stack.include_hooks )
|
27
27
|
|
28
28
|
end
|
29
29
|
|
@@ -33,7 +33,7 @@ module ModuleCluster::CascadeFeatures
|
|
33
33
|
|
34
34
|
def extend_object( hooked_instance )
|
35
35
|
|
36
|
-
ModuleCluster::CascadeFeatures.
|
36
|
+
ModuleCluster::CascadeFeatures.perform_cascades( self, :prepend_extend, hooked_instance, cluster_stack.prepend_extend_hooks )
|
37
37
|
|
38
38
|
super
|
39
39
|
|
@@ -47,7 +47,7 @@ module ModuleCluster::CascadeFeatures
|
|
47
47
|
|
48
48
|
super
|
49
49
|
|
50
|
-
ModuleCluster::CascadeFeatures.
|
50
|
+
ModuleCluster::CascadeFeatures.perform_cascades( self, :extend, hooked_instance, cluster_stack.extend_hooks )
|
51
51
|
|
52
52
|
end
|
53
53
|
|
@@ -2,66 +2,73 @@
|
|
2
2
|
module ModuleCluster::CascadeFeatures::PerformCascades
|
3
3
|
|
4
4
|
######################
|
5
|
-
#
|
5
|
+
# perform_cascades #
|
6
6
|
######################
|
7
7
|
|
8
|
-
def
|
8
|
+
def perform_cascades( module_self, action, hooked_instance, set_stack )
|
9
9
|
|
10
10
|
# This method is called when a ModuleCluster module is included or extended.
|
11
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
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
unless module_self.hooks_suspended?( action )
|
14
|
+
|
15
|
+
# for each set:
|
16
|
+
set_stack.each do |this_set|
|
17
|
+
|
18
|
+
# if this particular set is suspended, skip to the next
|
19
|
+
next if this_set.suspended
|
20
|
+
|
21
|
+
# Block sets simply run a block at a hook. They do not include or extend returns from the block.
|
22
|
+
# The hooked module will not be extended by ModuleCluster.
|
23
|
+
if this_set.is_a?( ModuleCluster::ClusterStack::Block::Set )
|
19
24
|
|
20
|
-
|
25
|
+
if this_set.dependency_module.should_run_block?( hooked_instance )
|
21
26
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
case this_set.runtime_block.arity
|
28
|
+
when 0
|
29
|
+
module_self.instance_eval( & this_set.runtime_block )
|
30
|
+
else
|
31
|
+
module_self.instance_exec( hooked_instance, & this_set.runtime_block )
|
32
|
+
end
|
28
33
|
|
29
|
-
|
34
|
+
end
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
36
|
+
# Other sets take parameters and an optional block. The optional block returns are included
|
37
|
+
# or extended like the parameters provided.
|
38
|
+
else
|
34
39
|
|
35
|
-
|
36
|
-
|
37
|
-
|
40
|
+
# dependency modules can cause instances to be included/extended and/or cascade
|
41
|
+
should_include = this_set.dependency_module.should_include_or_extend?( hooked_instance )
|
42
|
+
should_cascade = this_set.dependency_module.should_cascade?( hooked_instance )
|
38
43
|
|
39
|
-
|
40
|
-
|
44
|
+
# cascade parameter modules as appropriate
|
45
|
+
cascade_modules_into_hooked_instance( module_self, hooked_instance, this_set, this_set.modules ) if should_cascade
|
41
46
|
|
42
|
-
|
43
|
-
|
47
|
+
# include/extend parameter modules as appropriate
|
48
|
+
include_extend_modules( module_self, hooked_instance, this_set, this_set.modules ) if should_include
|
44
49
|
|
45
|
-
|
46
|
-
|
50
|
+
# process runtime block if present
|
51
|
+
if this_set.runtime_includes_or_extends_block
|
47
52
|
|
48
|
-
|
49
|
-
|
53
|
+
# if we have a runtime block, run block and collect returns as appropriate
|
54
|
+
if runtime_modules = collect_block_runtime_result_modules( module_self, hooked_instance, this_set )
|
50
55
|
|
51
|
-
|
52
|
-
|
56
|
+
# cascade return modules if appropriate
|
57
|
+
cascade_modules_into_hooked_instance( module_self, hooked_instance, this_set, runtime_modules ) if should_cascade
|
53
58
|
|
54
|
-
|
55
|
-
|
59
|
+
# include/extend return modules if appropriate
|
60
|
+
include_extend_modules( module_self, hooked_instance, this_set, runtime_modules ) if should_include
|
56
61
|
|
57
|
-
|
62
|
+
end
|
58
63
|
|
59
|
-
|
64
|
+
end
|
60
65
|
|
61
|
-
|
66
|
+
end
|
62
67
|
|
68
|
+
end
|
69
|
+
|
63
70
|
end
|
64
|
-
|
71
|
+
|
65
72
|
end
|
66
73
|
|
67
74
|
############################
|
@@ -159,15 +166,26 @@ module ModuleCluster::CascadeFeatures::PerformCascades
|
|
159
166
|
|
160
167
|
should_include_or_extend_instance = false
|
161
168
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
+
case module_class_instance_or_all
|
170
|
+
when :all, :module_or_class_or_instance, :module_and_class_and_instance,
|
171
|
+
:module_class_or_instance, :module_class_and_instance, :module_class_instance
|
172
|
+
should_include_or_extend_instance = true
|
173
|
+
when :module_or_class, :module_and_class, :module_class
|
174
|
+
should_include_or_extend_instance = into_instance.is_a?( Module )
|
175
|
+
when :module_or_instance, :module_and_instance, :module_instance
|
176
|
+
should_include_or_extend_instance = ( ! into_instance.is_a?( Module ) or
|
177
|
+
( into_instance.is_a?( Module ) && ! into_instance.is_a?( Class ) ) )
|
178
|
+
when :class_or_instance, :class_and_instance, :class_instance
|
179
|
+
should_include_or_extend_instance = ( into_instance.is_a?( Class ) or
|
180
|
+
! into_instance.is_a?( Module ) )
|
181
|
+
when :module
|
182
|
+
should_include_or_extend_instance = ( into_instance.is_a?( Module ) && ! into_instance.is_a?( Class ) )
|
183
|
+
when :class
|
184
|
+
should_include_or_extend_instance = into_instance.is_a?( Class )
|
185
|
+
when :instance
|
186
|
+
should_include_or_extend_instance = ! into_instance.is_a?( Module )
|
169
187
|
end
|
170
|
-
|
188
|
+
|
171
189
|
return should_include_or_extend_instance
|
172
190
|
|
173
191
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
|
2
2
|
class ModuleCluster::ClusterStack
|
3
3
|
|
4
|
-
include
|
5
|
-
include
|
6
|
-
include
|
7
|
-
include
|
8
|
-
include
|
4
|
+
include Block
|
5
|
+
include Includes
|
6
|
+
include Extends
|
7
|
+
include PrependsIncludes
|
8
|
+
include PrependsExtends
|
9
|
+
include Status
|
10
|
+
include Suspend
|
9
11
|
|
10
12
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
module ModuleCluster::ClusterStack::Block
|
3
3
|
|
4
|
-
include
|
5
|
-
include
|
6
|
-
include
|
4
|
+
include Class
|
5
|
+
include Module
|
6
|
+
include Instance
|
7
7
|
|
8
8
|
end
|
@@ -22,7 +22,7 @@ module ModuleCluster::ClusterStack::Block::Class
|
|
22
22
|
###########################
|
23
23
|
|
24
24
|
def prepend_class_include( dependency_module, runtime_block )
|
25
|
-
|
25
|
+
prepend_include_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
|
26
26
|
end
|
27
27
|
|
28
28
|
##########################
|
@@ -30,7 +30,7 @@ module ModuleCluster::ClusterStack::Block::Class
|
|
30
30
|
##########################
|
31
31
|
|
32
32
|
def prepend_class_extend( dependency_module, runtime_block )
|
33
|
-
|
33
|
+
prepend_extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
@@ -14,7 +14,7 @@ module ModuleCluster::ClusterStack::Block::Instance
|
|
14
14
|
#############################
|
15
15
|
|
16
16
|
def prepend_instance_extend( dependency_module, runtime_block )
|
17
|
-
|
17
|
+
prepend_extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -22,7 +22,7 @@ module ModuleCluster::ClusterStack::Block::Module
|
|
22
22
|
############################
|
23
23
|
|
24
24
|
def prepend_module_include( dependency_module, runtime_block )
|
25
|
-
|
25
|
+
prepend_include_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
|
26
26
|
end
|
27
27
|
|
28
28
|
###########################
|
@@ -30,7 +30,7 @@ module ModuleCluster::ClusterStack::Block::Module
|
|
30
30
|
###########################
|
31
31
|
|
32
32
|
def prepend_module_extend( dependency_module, runtime_block )
|
33
|
-
|
33
|
+
prepend_extend_hooks.push( ModuleCluster::ClusterStack::Block::Set.new( dependency_module, runtime_block ) )
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
@@ -6,7 +6,7 @@ module ModuleCluster::ClusterStack::Extends
|
|
6
6
|
##################
|
7
7
|
|
8
8
|
def extend_hooks
|
9
|
-
return @extend_hooks ||=
|
9
|
+
return @extend_hooks ||= ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new
|
10
10
|
end
|
11
11
|
|
12
12
|
#####################
|
@@ -14,7 +14,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
14
14
|
#####################
|
15
15
|
|
16
16
|
def extend_includes( module_instance, method, includes, runtime_includes_block )
|
17
|
-
|
17
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include, includes, runtime_includes_block )
|
18
|
+
extend_hooks.push( new_set )
|
19
|
+
return new_set
|
18
20
|
end
|
19
21
|
|
20
22
|
####################
|
@@ -22,7 +24,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
22
24
|
####################
|
23
25
|
|
24
26
|
def extend_extends( module_instance, method, extends, runtime_extends_block )
|
25
|
-
|
27
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :extend, extends, runtime_extends_block )
|
28
|
+
extend_hooks.push( new_set )
|
29
|
+
return new_set
|
26
30
|
end
|
27
31
|
|
28
32
|
#################################
|
@@ -30,7 +34,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
30
34
|
#################################
|
31
35
|
|
32
36
|
def extend_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
33
|
-
|
37
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
38
|
+
extend_hooks.push( new_set )
|
39
|
+
return new_set
|
34
40
|
end
|
35
41
|
|
36
42
|
############################
|
@@ -38,7 +44,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
38
44
|
############################
|
39
45
|
|
40
46
|
def module_extend_includes( module_instance, method, includes, runtime_includes_block )
|
41
|
-
|
47
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include, includes, runtime_includes_block )
|
48
|
+
extend_hooks.push( new_set )
|
49
|
+
return new_set
|
42
50
|
end
|
43
51
|
|
44
52
|
###########################
|
@@ -46,7 +54,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
46
54
|
###########################
|
47
55
|
|
48
56
|
def module_extend_extends( module_instance, method, extends, runtime_extends_block )
|
49
|
-
|
57
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :extend, extends, runtime_extends_block )
|
58
|
+
extend_hooks.push( new_set )
|
59
|
+
return new_set
|
50
60
|
end
|
51
61
|
|
52
62
|
########################################
|
@@ -54,7 +64,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
54
64
|
########################################
|
55
65
|
|
56
66
|
def module_extend_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
57
|
-
|
67
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
68
|
+
extend_hooks.push( new_set )
|
69
|
+
return new_set
|
58
70
|
end
|
59
71
|
|
60
72
|
###########################
|
@@ -62,7 +74,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
62
74
|
###########################
|
63
75
|
|
64
76
|
def class_extend_includes( module_instance, method, includes, runtime_includes_block )
|
65
|
-
|
77
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include, includes, runtime_includes_block )
|
78
|
+
extend_hooks.push( new_set )
|
79
|
+
return new_set
|
66
80
|
end
|
67
81
|
|
68
82
|
##########################
|
@@ -70,7 +84,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
70
84
|
##########################
|
71
85
|
|
72
86
|
def class_extend_extends( module_instance, method, extends, runtime_extends_block )
|
73
|
-
|
87
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :extend, extends, runtime_extends_block )
|
88
|
+
extend_hooks.push( new_set )
|
89
|
+
return new_set
|
74
90
|
end
|
75
91
|
|
76
92
|
#######################################
|
@@ -78,7 +94,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
78
94
|
#######################################
|
79
95
|
|
80
96
|
def class_extend_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
81
|
-
|
97
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
98
|
+
extend_hooks.push( new_set )
|
99
|
+
return new_set
|
82
100
|
end
|
83
101
|
|
84
102
|
##############################
|
@@ -86,7 +104,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
86
104
|
##############################
|
87
105
|
|
88
106
|
def instance_extend_includes( module_instance, method, includes, runtime_includes_block )
|
89
|
-
|
107
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :include, includes, runtime_includes_block )
|
108
|
+
extend_hooks.push( new_set )
|
109
|
+
return new_set
|
90
110
|
end
|
91
111
|
|
92
112
|
#############################
|
@@ -94,7 +114,9 @@ module ModuleCluster::ClusterStack::Extends
|
|
94
114
|
#############################
|
95
115
|
|
96
116
|
def instance_extend_extends( module_instance, method, extends, runtime_extends_block )
|
97
|
-
|
117
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :extend, extends, runtime_extends_block )
|
118
|
+
extend_hooks.push( new_set )
|
119
|
+
return new_set
|
98
120
|
end
|
99
121
|
|
100
122
|
##########################################
|
@@ -102,7 +124,17 @@ module ModuleCluster::ClusterStack::Extends
|
|
102
124
|
##########################################
|
103
125
|
|
104
126
|
def instance_extend_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
105
|
-
|
127
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :instance, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
128
|
+
extend_hooks.push( new_set )
|
129
|
+
return new_set
|
130
|
+
end
|
131
|
+
|
132
|
+
######################
|
133
|
+
# has_extend_hook? #
|
134
|
+
######################
|
135
|
+
|
136
|
+
def has_extend_hook?( description )
|
137
|
+
return extend_hooks.hooks_with( description ) || false
|
106
138
|
end
|
107
139
|
|
108
140
|
end
|
@@ -6,7 +6,7 @@ module ModuleCluster::ClusterStack::Includes
|
|
6
6
|
###################
|
7
7
|
|
8
8
|
def include_hooks
|
9
|
-
return @include_hooks ||=
|
9
|
+
return @include_hooks ||= ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new
|
10
10
|
end
|
11
11
|
|
12
12
|
######################
|
@@ -14,7 +14,9 @@ module ModuleCluster::ClusterStack::Includes
|
|
14
14
|
######################
|
15
15
|
|
16
16
|
def include_includes( module_instance, method, includes, runtime_includes_block )
|
17
|
-
|
17
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include, includes, runtime_includes_block )
|
18
|
+
include_hooks.push( new_set )
|
19
|
+
return new_set
|
18
20
|
end
|
19
21
|
|
20
22
|
#####################
|
@@ -22,7 +24,9 @@ module ModuleCluster::ClusterStack::Includes
|
|
22
24
|
#####################
|
23
25
|
|
24
26
|
def include_extends( module_instance, method, extends, runtime_extends_block )
|
25
|
-
|
27
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :extend, extends, runtime_extends_block )
|
28
|
+
include_hooks.push( new_set )
|
29
|
+
return new_set
|
26
30
|
end
|
27
31
|
|
28
32
|
##################################
|
@@ -30,7 +34,9 @@ module ModuleCluster::ClusterStack::Includes
|
|
30
34
|
##################################
|
31
35
|
|
32
36
|
def include_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
33
|
-
|
37
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :all, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
38
|
+
include_hooks.push( new_set )
|
39
|
+
return new_set
|
34
40
|
end
|
35
41
|
|
36
42
|
#############################
|
@@ -38,7 +44,9 @@ module ModuleCluster::ClusterStack::Includes
|
|
38
44
|
#############################
|
39
45
|
|
40
46
|
def module_include_includes( module_instance, method, includes, runtime_includes_block )
|
41
|
-
|
47
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include, includes, runtime_includes_block )
|
48
|
+
include_hooks.push( new_set )
|
49
|
+
return new_set
|
42
50
|
end
|
43
51
|
|
44
52
|
############################
|
@@ -46,7 +54,9 @@ module ModuleCluster::ClusterStack::Includes
|
|
46
54
|
############################
|
47
55
|
|
48
56
|
def module_include_extends( module_instance, method, extends, runtime_extends_block )
|
49
|
-
|
57
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :extend, extends, runtime_extends_block )
|
58
|
+
include_hooks.push( new_set )
|
59
|
+
return new_set
|
50
60
|
end
|
51
61
|
|
52
62
|
#########################################
|
@@ -54,7 +64,9 @@ module ModuleCluster::ClusterStack::Includes
|
|
54
64
|
#########################################
|
55
65
|
|
56
66
|
def module_include_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
57
|
-
|
67
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :module, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
68
|
+
include_hooks.push( new_set )
|
69
|
+
return new_set
|
58
70
|
end
|
59
71
|
|
60
72
|
############################
|
@@ -62,7 +74,9 @@ module ModuleCluster::ClusterStack::Includes
|
|
62
74
|
############################
|
63
75
|
|
64
76
|
def class_include_includes( module_instance, method, includes, runtime_includes_block )
|
65
|
-
|
77
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include, includes, runtime_includes_block )
|
78
|
+
include_hooks.push( new_set )
|
79
|
+
return new_set
|
66
80
|
end
|
67
81
|
|
68
82
|
###########################
|
@@ -70,7 +84,9 @@ module ModuleCluster::ClusterStack::Includes
|
|
70
84
|
###########################
|
71
85
|
|
72
86
|
def class_include_extends( module_instance, method, extends, runtime_extends_block )
|
73
|
-
|
87
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :extend, extends, runtime_extends_block )
|
88
|
+
include_hooks.push( new_set )
|
89
|
+
return new_set
|
74
90
|
end
|
75
91
|
|
76
92
|
########################################
|
@@ -78,7 +94,17 @@ module ModuleCluster::ClusterStack::Includes
|
|
78
94
|
########################################
|
79
95
|
|
80
96
|
def class_include_includes_and_extends( module_instance, method, includes_and_extends, runtime_includes_and_extends_block )
|
81
|
-
|
97
|
+
new_set = ModuleCluster::ClusterStack::Set.new( module_instance, method, :class, :include_and_extend, includes_and_extends, runtime_includes_and_extends_block )
|
98
|
+
include_hooks.push( new_set )
|
99
|
+
return new_set
|
100
|
+
end
|
101
|
+
|
102
|
+
#######################
|
103
|
+
# has_include_hook? #
|
104
|
+
#######################
|
105
|
+
|
106
|
+
def has_include_hook?( description )
|
107
|
+
return include_hooks.hooks_with( description ) || false
|
82
108
|
end
|
83
109
|
|
84
110
|
end
|