module-cluster 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -35,6 +35,25 @@ module SomeModule
35
35
  end
36
36
  ```
37
37
 
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:
39
+
40
+ ```ruby
41
+ module SomeModule
42
+ include ModuleCluster
43
+ include_also_includes( SomeOtherModule ) do
44
+ AnotherModule
45
+ end
46
+ end
47
+ ```
48
+
49
+ Blocks can be used to return dynamically-determined modules at runtime.
50
+
51
+ ```ruby
52
+ class_or_module.include_or_extend_cascades_prepending_extends do
53
+ method_that_returns_one_or_more_modules
54
+ end
55
+ ```
56
+
38
57
  Calls to the various functions are cumulative and stack in the order called. This permits multiple calls, whether subsequently or otherwise.
39
58
 
40
59
  # Methods #
@@ -123,6 +142,16 @@ Cascade to module methods (does not cascade to classes):
123
142
  * include_or_extend_cascades_to_module_prepending_extends
124
143
  * include_or_extend_cascades_to_module_prepending_includes_and_extends
125
144
 
145
+ Block methods (used for nesting declarations, for instance to apply cascades only after first module/class):
146
+
147
+ ```ruby
148
+ prepend_module_include do |class_or_module|
149
+ class_or_module.include_or_extend_cascades_prepending_extends do
150
+ method_that_returns_one_or_more_modules
151
+ end
152
+ end
153
+ ```
154
+
126
155
  # License #
127
156
 
128
157
  (The MIT License)
data/README.rdoc CHANGED
@@ -31,6 +31,21 @@ module SomeModule
31
31
  include_also_includes( SomeOtherModule )
32
32
  end
33
33
 
34
+ Additionally, all methods accept a block that returns one or more modules; the modules will be added *after* any modules specified in the parameters:
35
+
36
+ module SomeModule
37
+ include ModuleCluster
38
+ include_also_includes( SomeOtherModule ) do
39
+ AnotherModule
40
+ end
41
+ end
42
+
43
+ Blocks can be used to return dynamically-determined modules at runtime.
44
+
45
+ class_or_module.include_or_extend_cascades_prepending_extends do
46
+ method_that_returns_one_or_more_modules
47
+ end
48
+
34
49
  Calls to the various functions are cumulative and stack in the order called. This permits multiple calls, whether subsequently or otherwise.
35
50
 
36
51
  == Methods
@@ -119,6 +134,14 @@ Cascade to module methods (does not cascade to classes):
119
134
  * include_or_extend_cascades_to_module_prepending_extends
120
135
  * include_or_extend_cascades_to_module_prepending_includes_and_extends
121
136
 
137
+ Block methods (used for nesting declarations, for instance to apply cascades only after first module/class, or for dynamic declarations):
138
+
139
+ prepend_module_include do |class_or_module|
140
+ class_or_module.include_or_extend_cascades_prepending_extends do
141
+ method_that_returns_one_or_more_modules
142
+ end
143
+ end
144
+
122
145
  == License
123
146
 
124
147
  (The MIT License)
@@ -1,11 +1,23 @@
1
1
 
2
2
  module ModuleCluster
3
3
  class ClusterStack
4
+ module Block
5
+ module Class
6
+ end
7
+ module Module
8
+ end
9
+ end
4
10
  end
5
11
  module CascadeFeatures
6
12
  end
7
13
  module Define
8
- module DedoubleAncestors
14
+ module Block
15
+ module Class
16
+ end
17
+ module Module
18
+ end
19
+ module ClassOrModule
20
+ end
9
21
  end
10
22
  module ClusterStack
11
23
  end
@@ -23,14 +35,24 @@ module ModuleCluster
23
35
  end
24
36
 
25
37
  require_relative 'module-cluster/ModuleCluster/CascadeFeatures.rb'
26
- require_relative 'module-cluster/ModuleCluster/Define/DedoubleAncestors.rb'
27
38
  require_relative 'module-cluster/ModuleCluster/ExtendForCascade.rb'
28
39
  require_relative 'module-cluster/ModuleCluster/Define/ClusterStack.rb'
40
+ require_relative 'module-cluster/ModuleCluster/Define/Block/Class.rb'
41
+ require_relative 'module-cluster/ModuleCluster/Define/Block/Module.rb'
42
+ require_relative 'module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb'
43
+ require_relative 'module-cluster/ModuleCluster/Define/Block.rb'
29
44
  require_relative 'module-cluster/ModuleCluster/Define/Cluster.rb'
30
45
  require_relative 'module-cluster/ModuleCluster/Define/ClusterCascades.rb'
31
46
  require_relative 'module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb'
32
47
  require_relative 'module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb'
33
48
  require_relative 'module-cluster/ModuleCluster/Define/Deprecated.rb'
49
+ require_relative 'module-cluster/ModuleCluster/ClusterStack/Includes.rb'
50
+ require_relative 'module-cluster/ModuleCluster/ClusterStack/Extends.rb'
51
+ require_relative 'module-cluster/ModuleCluster/ClusterStack/PrependsIncludes.rb'
52
+ require_relative 'module-cluster/ModuleCluster/ClusterStack/PrependsExtends.rb'
53
+ require_relative 'module-cluster/ModuleCluster/ClusterStack/Block/Class.rb'
54
+ require_relative 'module-cluster/ModuleCluster/ClusterStack/Block/Module.rb'
55
+ require_relative 'module-cluster/ModuleCluster/ClusterStack/Block.rb'
34
56
  require_relative 'module-cluster/ModuleCluster/ClusterStack.rb'
35
57
  require_relative 'module-cluster/ModuleCluster.rb'
36
58
 
@@ -3,11 +3,12 @@ module ModuleCluster
3
3
 
4
4
  extend ModuleCluster::ExtendForCascade
5
5
 
6
+ include ModuleCluster::Define::Block
6
7
  include ModuleCluster::Define::Cluster
7
8
  include ModuleCluster::Define::ClusterCascades
8
9
  include ModuleCluster::Define::ClusterCascadesToClass
9
10
  include ModuleCluster::Define::ClusterCascadesToModule
10
11
 
11
12
  include ModuleCluster::Define::Deprecated
12
-
13
+
13
14
  end
@@ -13,58 +13,81 @@ module ModuleCluster::CascadeFeatures
13
13
  includes_or_extends = nil
14
14
 
15
15
  case runtime_includes_or_extends_block.arity
16
- when 0
17
- includes_or_extends = module_self.instance_eval( & runtime_includes_or_extends_block )
18
- else
19
- includes_or_extends = module_self.instance_exec( class_or_module, & runtime_includes_or_extends_block )
16
+ when 0
17
+ includes_or_extends = module_self.instance_eval( & runtime_includes_or_extends_block )
18
+ else
19
+ includes_or_extends = module_self.instance_exec( class_or_module, & runtime_includes_or_extends_block )
20
20
  end
21
-
21
+
22
+ unless includes_or_extends.is_a?( Array )
23
+ includes_or_extends = [ includes_or_extends ]
24
+ end
25
+
22
26
  return includes_or_extends
23
27
 
24
28
  end
25
29
 
26
- ############################################
27
- # self.includes_or_extends_for_set_stack #
28
- ############################################
30
+ #######################################
31
+ # self.cascade_struct_for_set_stack #
32
+ #######################################
29
33
 
30
- def self.includes_or_extends_for_set_stack( module_self, class_or_module, set_stack )
34
+ def self.cascade_struct_for_set_stack( module_self, class_or_module, set_stack )
31
35
 
32
36
  includes = Array.new
33
37
  extends = Array.new
34
38
  cascades = Hash.new
35
39
 
36
40
  set_stack.each do |this_set|
37
-
38
- # get cascades
39
- if this_set.dependency_module.should_cascade?( class_or_module )
40
- cascades[ this_set.dependency_module ] ||= Hash.new
41
- cascades[ this_set.dependency_module ][ this_set.method ] ||= Array.new
42
- cascades[ this_set.dependency_module ][ this_set.method ].concat( this_set.modules )
43
- end
44
-
45
- # get runtime block
46
- runtime_set = nil
47
- if block = this_set.runtime_includes_or_extends_block
48
- runtime_set = ModuleCluster::CascadeFeatures.get_runtime_includes_or_extends_from_block( module_self,
49
- class_or_module,
50
- this_set.include_or_extend,
51
- block )
52
- end
53
41
 
54
- # get includes/extends
55
- case this_set.include_or_extend
56
- when :include
57
- this_set.modules.each do |this_module|
42
+ if this_set.is_a?( ModuleCluster::ClusterStack::Block::Set )
43
+
44
+ class_or_module.instance_eval do
45
+ extend( ModuleCluster )
46
+ end
47
+
48
+ case this_set.runtime_block.arity
49
+ when 0
50
+ module_self.instance_eval( & this_set.runtime_block )
51
+ else
52
+ module_self.instance_exec( class_or_module, & this_set.runtime_block )
53
+ end
54
+
55
+ else
56
+
57
+ # get cascades
58
+ if this_set.dependency_module.should_cascade?( class_or_module )
59
+ cascades[ this_set.dependency_module ] ||= Hash.new
60
+ cascades[ this_set.dependency_module ][ this_set.method ] ||= Array.new
61
+ cascades[ this_set.dependency_module ][ this_set.method ].concat( this_set.modules )
62
+ end
63
+
64
+ # get runtime block
65
+ runtime_set = nil
66
+ if block = this_set.runtime_includes_or_extends_block
67
+ runtime_set = ModuleCluster::CascadeFeatures.get_runtime_includes_or_extends_from_block( module_self,
68
+ class_or_module,
69
+ this_set.include_or_extend,
70
+ block )
71
+ cascades[ this_set.dependency_module ] ||= Hash.new
72
+ cascades[ this_set.dependency_module ][ this_set.method ] ||= Array.new
73
+ cascades[ this_set.dependency_module ][ this_set.method ].concat( runtime_set )
74
+ end
75
+ # get includes/extends
76
+ case this_set.include_or_extend
77
+ when :include
78
+ this_set.modules.each do |this_module|
79
+ if this_set.dependency_module.should_include_or_extend?( class_or_module )
80
+ includes.concat( this_set.modules )
81
+ end
82
+ end
83
+ includes.concat( runtime_set ) if runtime_set
84
+ when :extend
58
85
  if this_set.dependency_module.should_include_or_extend?( class_or_module )
59
- includes.concat( this_set.modules )
86
+ extends.concat( this_set.modules )
60
87
  end
61
- end
62
- includes.concat( runtime_set ) if runtime_set
63
- when :extend
64
- if this_set.dependency_module.should_include_or_extend?( class_or_module )
65
- extends.concat( this_set.modules )
66
- end
67
- extends.concat( runtime_set ) if runtime_set
88
+ extends.concat( runtime_set ) if runtime_set
89
+ end
90
+
68
91
  end
69
92
 
70
93
  end
@@ -105,8 +128,8 @@ module ModuleCluster::CascadeFeatures
105
128
  #####################
106
129
 
107
130
  def append_features( class_or_module )
108
-
109
- cascade_struct = ModuleCluster::CascadeFeatures.includes_or_extends_for_set_stack( self, class_or_module, cluster_stack.cascading_prepending_includes )
131
+
132
+ cascade_struct = ModuleCluster::CascadeFeatures.cascade_struct_for_set_stack( self, class_or_module, cluster_stack.cascading_prepending_includes )
110
133
  ModuleCluster::CascadeFeatures.cascade_features( class_or_module, cascade_struct )
111
134
 
112
135
  super
@@ -121,7 +144,7 @@ module ModuleCluster::CascadeFeatures
121
144
 
122
145
  super
123
146
 
124
- cascade_struct = ModuleCluster::CascadeFeatures.includes_or_extends_for_set_stack( self, class_or_module, cluster_stack.cascading_includes )
147
+ cascade_struct = ModuleCluster::CascadeFeatures.cascade_struct_for_set_stack( self, class_or_module, cluster_stack.cascading_includes )
125
148
  ModuleCluster::CascadeFeatures.cascade_features( class_or_module, cascade_struct )
126
149
 
127
150
  end
@@ -132,7 +155,7 @@ module ModuleCluster::CascadeFeatures
132
155
 
133
156
  def extend_object( class_or_module )
134
157
 
135
- cascade_struct = ModuleCluster::CascadeFeatures.includes_or_extends_for_set_stack( self, class_or_module, cluster_stack.cascading_prepending_extends )
158
+ cascade_struct = ModuleCluster::CascadeFeatures.cascade_struct_for_set_stack( self, class_or_module, cluster_stack.cascading_prepending_extends )
136
159
  ModuleCluster::CascadeFeatures.cascade_features( class_or_module, cascade_struct )
137
160
 
138
161
  super
@@ -147,7 +170,7 @@ module ModuleCluster::CascadeFeatures
147
170
 
148
171
  super
149
172
 
150
- cascade_struct = ModuleCluster::CascadeFeatures.includes_or_extends_for_set_stack( self, class_or_module, cluster_stack.cascading_extends )
173
+ cascade_struct = ModuleCluster::CascadeFeatures.cascade_struct_for_set_stack( self, class_or_module, cluster_stack.cascading_extends )
151
174
  ModuleCluster::CascadeFeatures.cascade_features( class_or_module, cascade_struct )
152
175
 
153
176
  end
@@ -3,100 +3,10 @@ class ModuleCluster::ClusterStack
3
3
 
4
4
  Set = Struct.new( :dependency_module, :method, :include_or_extend, :modules, :runtime_includes_or_extends_block )
5
5
 
6
- ########################
7
- # cascading_includes #
8
- ########################
9
-
10
- def cascading_includes
11
- return @cascading_includes ||= Array.new
12
- end
13
-
14
- #######################
15
- # cascading_extends #
16
- #######################
17
-
18
- def cascading_extends
19
- return @cascading_extends ||= Array.new
20
- end
21
-
22
- ###################################
23
- # cascading_prepending_includes #
24
- ###################################
25
-
26
- def cascading_prepending_includes
27
- return @cascading_prepending_includes ||= Array.new
28
- end
29
-
30
- ##################################
31
- # cascading_prepending_extends #
32
- ##################################
33
-
34
- def cascading_prepending_extends
35
- return @cascading_prepending_extends ||= Array.new
36
- end
37
-
38
- ######################
39
- # include_includes #
40
- ######################
41
-
42
- def include_includes( module_instance, method, includes, runtime_includes_block )
43
- cascading_includes.push( Set.new( module_instance, method, :include, includes, runtime_includes_block ) )
44
- end
45
-
46
- #####################
47
- # include_extends #
48
- #####################
49
-
50
- def include_extends( module_instance, method, extends, runtime_extends_block )
51
- cascading_includes.push( Set.new( module_instance, method, :extend, extends, runtime_extends_block ) )
52
- end
53
-
54
- #####################
55
- # extend_includes #
56
- #####################
6
+ include ModuleCluster::ClusterStack::Block
7
+ include ModuleCluster::ClusterStack::Includes
8
+ include ModuleCluster::ClusterStack::Extends
9
+ include ModuleCluster::ClusterStack::PrependsIncludes
10
+ include ModuleCluster::ClusterStack::PrependsExtends
57
11
 
58
- def extend_includes( module_instance, method, includes, runtime_includes_block )
59
- cascading_extends.push( Set.new( module_instance, method, :include, includes, runtime_includes_block ) )
60
- end
61
-
62
- ####################
63
- # extend_extends #
64
- ####################
65
-
66
- def extend_extends( module_instance, method, extends, runtime_extends_block )
67
- cascading_extends.push( Set.new( module_instance, method, :extend, extends, runtime_extends_block ) )
68
- end
69
-
70
- ###############################
71
- # include_prepends_includes #
72
- ###############################
73
-
74
- def include_prepends_includes( module_instance, method, includes, runtime_includes_block )
75
- cascading_prepending_includes.push( Set.new( module_instance, method, :include, includes, runtime_includes_block ) )
76
- end
77
-
78
- ##############################
79
- # include_prepends_extends #
80
- ##############################
81
-
82
- def include_prepends_extends( module_instance, method, extends, runtime_extends_block )
83
- cascading_prepending_includes.push( Set.new( module_instance, method, :extend, extends, runtime_extends_block ) )
84
- end
85
-
86
- ##############################
87
- # extend_prepends_includes #
88
- ##############################
89
-
90
- def extend_prepends_includes( module_instance, method, includes, runtime_includes_block )
91
- cascading_prepending_extends.push( Set.new( module_instance, method, :include, includes, runtime_includes_block ) )
92
- end
93
-
94
- #############################
95
- # extend_prepends_extends #
96
- #############################
97
-
98
- def extend_prepends_extends( module_instance, method, extends, runtime_extends_block )
99
- cascading_prepending_extends.push( Set.new( module_instance, method, :extend, extends, runtime_extends_block ) )
100
- end
101
-
102
12
  end
@@ -0,0 +1,9 @@
1
+
2
+ module ModuleCluster::ClusterStack::Block
3
+
4
+ Set = Struct.new( :runtime_block )
5
+
6
+ include ModuleCluster::ClusterStack::Block::Class
7
+ include ModuleCluster::ClusterStack::Block::Module
8
+
9
+ end
@@ -0,0 +1,36 @@
1
+
2
+ module ModuleCluster::ClusterStack::Block::Class
3
+
4
+ ###################
5
+ # class_include #
6
+ ###################
7
+
8
+ def class_include( runtime_block )
9
+ cascading_includes.push( ModuleCluster::ClusterStack::Block::Set.new( runtime_block ) )
10
+ end
11
+
12
+ ##################
13
+ # class_extend #
14
+ ##################
15
+
16
+ def class_extend( runtime_block )
17
+ cascading_extends.push( ModuleCluster::ClusterStack::Block::Set.new( runtime_block ) )
18
+ end
19
+
20
+ ###########################
21
+ # prepend_class_include #
22
+ ###########################
23
+
24
+ def prepend_class_include( runtime_block )
25
+ cascading_prepending_includes.push( ModuleCluster::ClusterStack::Block::Set.new( runtime_block ) )
26
+ end
27
+
28
+ ##########################
29
+ # prepend_class_extend #
30
+ ##########################
31
+
32
+ def prepend_class_extend( runtime_block )
33
+ cascading_prepending_extends.push( ModuleCluster::ClusterStack::Block::Set.new( runtime_block ) )
34
+ end
35
+
36
+ end
@@ -0,0 +1,36 @@
1
+
2
+ module ModuleCluster::ClusterStack::Block::Module
3
+
4
+ ####################
5
+ # module_include #
6
+ ####################
7
+
8
+ def module_include( runtime_block )
9
+ cascading_includes.push( ModuleCluster::ClusterStack::Block::Set.new( runtime_block ) )
10
+ end
11
+
12
+ ###################
13
+ # module_extend #
14
+ ###################
15
+
16
+ def module_extend( runtime_block )
17
+ cascading_extends.push( ModuleCluster::ClusterStack::Block::Set.new( runtime_block ) )
18
+ end
19
+
20
+ ############################
21
+ # prepend_module_include #
22
+ ############################
23
+
24
+ def prepend_module_include( runtime_block )
25
+ cascading_prepending_includes.push( ModuleCluster::ClusterStack::Block::Set.new( runtime_block ) )
26
+ end
27
+
28
+ ###########################
29
+ # prepend_module_extend #
30
+ ###########################
31
+
32
+ def prepend_module_extend( runtime_block )
33
+ cascading_prepending_extends.push( ModuleCluster::ClusterStack::Block::Set.new( runtime_block ) )
34
+ end
35
+
36
+ end
@@ -0,0 +1,29 @@
1
+
2
+ module ModuleCluster::ClusterStack::Extends
3
+
4
+ #######################
5
+ # cascading_extends #
6
+ #######################
7
+
8
+ def cascading_extends
9
+ return @cascading_extends ||= Array.new
10
+ end
11
+
12
+ #####################
13
+ # extend_includes #
14
+ #####################
15
+
16
+ def extend_includes( module_instance, method, includes, runtime_includes_block )
17
+ cascading_extends.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :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
+ cascading_extends.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :extend, extends, runtime_extends_block ) )
26
+ end
27
+
28
+
29
+ end
@@ -0,0 +1,28 @@
1
+
2
+ module ModuleCluster::ClusterStack::Includes
3
+
4
+ ########################
5
+ # cascading_includes #
6
+ ########################
7
+
8
+ def cascading_includes
9
+ return @cascading_includes ||= Array.new
10
+ end
11
+
12
+ ######################
13
+ # include_includes #
14
+ ######################
15
+
16
+ def include_includes( module_instance, method, includes, runtime_includes_block )
17
+ cascading_includes.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :include, includes, runtime_includes_block ) )
18
+ end
19
+
20
+ #####################
21
+ # include_extends #
22
+ #####################
23
+
24
+ def include_extends( module_instance, method, extends, runtime_extends_block )
25
+ cascading_includes.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :extend, extends, runtime_extends_block ) )
26
+ end
27
+
28
+ end
@@ -0,0 +1,28 @@
1
+
2
+ module ModuleCluster::ClusterStack::PrependsExtends
3
+
4
+ ##################################
5
+ # cascading_prepending_extends #
6
+ ##################################
7
+
8
+ def cascading_prepending_extends
9
+ return @cascading_prepending_extends ||= Array.new
10
+ end
11
+
12
+ ##############################
13
+ # extend_prepends_includes #
14
+ ##############################
15
+
16
+ def extend_prepends_includes( module_instance, method, includes, runtime_includes_block )
17
+ cascading_prepending_extends.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :include, includes, runtime_includes_block ) )
18
+ end
19
+
20
+ #############################
21
+ # extend_prepends_extends #
22
+ #############################
23
+
24
+ def extend_prepends_extends( module_instance, method, extends, runtime_extends_block )
25
+ cascading_prepending_extends.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :extend, extends, runtime_extends_block ) )
26
+ end
27
+
28
+ end
@@ -0,0 +1,28 @@
1
+
2
+ module ModuleCluster::ClusterStack::PrependsIncludes
3
+
4
+ ###################################
5
+ # cascading_prepending_includes #
6
+ ###################################
7
+
8
+ def cascading_prepending_includes
9
+ return @cascading_prepending_includes ||= Array.new
10
+ end
11
+
12
+ ###############################
13
+ # include_prepends_includes #
14
+ ###############################
15
+
16
+ def include_prepends_includes( module_instance, method, includes, runtime_includes_block )
17
+ cascading_prepending_includes.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :include, includes, runtime_includes_block ) )
18
+ end
19
+
20
+ ##############################
21
+ # include_prepends_extends #
22
+ ##############################
23
+
24
+ def include_prepends_extends( module_instance, method, extends, runtime_extends_block )
25
+ cascading_prepending_includes.push( ModuleCluster::ClusterStack::Set.new( module_instance, method, :extend, extends, runtime_extends_block ) )
26
+ end
27
+
28
+ end
@@ -0,0 +1,6 @@
1
+
2
+ module ModuleCluster::Define::Block
3
+
4
+ include ModuleCluster::Define::Block::ClassOrModule
5
+
6
+ end
@@ -0,0 +1,54 @@
1
+
2
+ module ModuleCluster::Define::Block::Class
3
+
4
+ ###################
5
+ # class_include #
6
+ ###################
7
+
8
+ def class_include( & runtime_block )
9
+ cluster_stack.class_include( runtime_block )
10
+ end
11
+
12
+ ##################
13
+ # class_extend #
14
+ ##################
15
+
16
+ def class_extend( & runtime_block )
17
+ cluster_stack.class_extend( runtime_block )
18
+ end
19
+
20
+ #############################
21
+ # class_include_or_extend #
22
+ #############################
23
+
24
+ def class_include_or_extend( & runtime_block )
25
+ class_include( & runtime_block )
26
+ class_extend( & runtime_block )
27
+ end
28
+
29
+ ###########################
30
+ # prepend_class_include #
31
+ ###########################
32
+
33
+ def prepend_class_include( & runtime_block )
34
+ cluster_stack.prepend_class_include( runtime_block )
35
+ end
36
+
37
+ ##########################
38
+ # prepend_class_extend #
39
+ ##########################
40
+
41
+ def prepend_class_extend( & runtime_block )
42
+ cluster_stack.prepend_class_extend( runtime_block )
43
+ end
44
+
45
+ #####################################
46
+ # prepend_class_include_or_extend #
47
+ #####################################
48
+
49
+ def prepend_class_include_or_extend( & runtime_block )
50
+ prepend_class_include( & runtime_block )
51
+ prepend_class_extend( & runtime_block )
52
+ end
53
+
54
+ end
@@ -0,0 +1,61 @@
1
+
2
+ module ModuleCluster::Define::Block::ClassOrModule
3
+
4
+ include ModuleCluster::Define::Block::Class
5
+ include ModuleCluster::Define::Block::Module
6
+
7
+ #############################
8
+ # class_or_module_include #
9
+ #############################
10
+
11
+ def class_or_module_include( & runtime_block )
12
+ class_include( & runtime_block )
13
+ module_include( & runtime_block )
14
+ end
15
+
16
+ ############################
17
+ # class_or_module_extend #
18
+ ############################
19
+
20
+ def class_or_module_extend( & runtime_block )
21
+ class_extend( & runtime_block )
22
+ module_extend( & runtime_block )
23
+ end
24
+
25
+ #######################################
26
+ # class_or_module_include_or_extend #
27
+ #######################################
28
+
29
+ def class_or_module_include_or_extend( & runtime_block )
30
+ class_or_module_include( & runtime_block )
31
+ class_or_module_extend( & runtime_block )
32
+ end
33
+
34
+ #####################################
35
+ # prepend_class_or_module_include #
36
+ #####################################
37
+
38
+ def prepend_class_or_module_include( & runtime_block )
39
+ prepend_class_include( & runtime_block )
40
+ prepend_module_include( & runtime_block )
41
+ end
42
+
43
+ ####################################
44
+ # prepend_class_or_module_extend #
45
+ ####################################
46
+
47
+ def prepend_class_or_module_extend( & runtime_block )
48
+ prepend_class_extend( & runtime_block )
49
+ prepend_module_extend( & runtime_block )
50
+ end
51
+
52
+ ###############################################
53
+ # prepend_class_or_module_include_or_extend #
54
+ ###############################################
55
+
56
+ def prepend_class_or_module_include_or_extend( & runtime_block )
57
+ prepend_class_or_module_include( & runtime_block )
58
+ prepend_class_or_module_extend( & runtime_block )
59
+ end
60
+
61
+ end
@@ -0,0 +1,54 @@
1
+
2
+ module ModuleCluster::Define::Block::Module
3
+
4
+ ####################
5
+ # module_include #
6
+ ####################
7
+
8
+ def module_include( & runtime_block )
9
+ cluster_stack.module_include( runtime_block )
10
+ end
11
+
12
+ ###################
13
+ # module_extend #
14
+ ###################
15
+
16
+ def module_extend( & runtime_block )
17
+ cluster_stack.module_extend( runtime_block )
18
+ end
19
+
20
+ ##############################
21
+ # module_include_or_extend #
22
+ ##############################
23
+
24
+ def module_include_or_extend( & runtime_block )
25
+ module_include( & runtime_block )
26
+ module_extend( & runtime_block )
27
+ end
28
+
29
+ ############################
30
+ # prepend_module_include #
31
+ ############################
32
+
33
+ def prepend_module_include( & runtime_block )
34
+ cluster_stack.prepend_module_include( runtime_block )
35
+ end
36
+
37
+ ###########################
38
+ # prepend_module_extend #
39
+ ###########################
40
+
41
+ def prepend_module_extend( & runtime_block )
42
+ cluster_stack.prepend_module_extend( runtime_block )
43
+ end
44
+
45
+ ######################################
46
+ # prepend_module_include_or_extend #
47
+ ######################################
48
+
49
+ def prepend_module_include_or_extend( & runtime_block )
50
+ prepend_module_include( & runtime_block )
51
+ prepend_module_extend( & runtime_block )
52
+ end
53
+
54
+ end
@@ -26,6 +26,7 @@ module ModuleCluster::Define::Cluster
26
26
  ###########################
27
27
 
28
28
  def self.perform_cascades( class_or_module, method, modules )
29
+ # nothing required
29
30
  end
30
31
 
31
32
  ###########################
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 3
8
- - 2
9
- version: 1.3.2
8
+ - 3
9
+ version: 1.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Asher
@@ -28,13 +28,23 @@ extra_rdoc_files: []
28
28
 
29
29
  files:
30
30
  - lib/module-cluster/ModuleCluster/CascadeFeatures.rb
31
+ - lib/module-cluster/ModuleCluster/ClusterStack/Block/Class.rb
32
+ - lib/module-cluster/ModuleCluster/ClusterStack/Block/Module.rb
33
+ - lib/module-cluster/ModuleCluster/ClusterStack/Block.rb
34
+ - lib/module-cluster/ModuleCluster/ClusterStack/Extends.rb
35
+ - lib/module-cluster/ModuleCluster/ClusterStack/Includes.rb
36
+ - lib/module-cluster/ModuleCluster/ClusterStack/PrependsExtends.rb
37
+ - lib/module-cluster/ModuleCluster/ClusterStack/PrependsIncludes.rb
31
38
  - lib/module-cluster/ModuleCluster/ClusterStack.rb
39
+ - lib/module-cluster/ModuleCluster/Define/Block/Class.rb
40
+ - lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb
41
+ - lib/module-cluster/ModuleCluster/Define/Block/Module.rb
42
+ - lib/module-cluster/ModuleCluster/Define/Block.rb
32
43
  - lib/module-cluster/ModuleCluster/Define/Cluster.rb
33
44
  - lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb
34
45
  - lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb
35
46
  - lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb
36
47
  - lib/module-cluster/ModuleCluster/Define/ClusterStack.rb
37
- - lib/module-cluster/ModuleCluster/Define/DedoubleAncestors.rb
38
48
  - lib/module-cluster/ModuleCluster/Define/Deprecated.rb
39
49
  - lib/module-cluster/ModuleCluster/ExtendForCascade.rb
40
50
  - lib/module-cluster/ModuleCluster.rb
@@ -1,22 +0,0 @@
1
-
2
- module ModuleCluster::Define::DedoubleAncestors
3
-
4
- ####################################
5
- # dedouble_modules_for_ancestors #
6
- ####################################
7
-
8
- def dedouble_modules_for_ancestors( include_or_extend, *modules )
9
-
10
- case include_or_extend
11
- when :include
12
- modules -= ancestors
13
- when :extend
14
- eigenclass = class << self ; self ; end
15
- modules -= eigenclass.ancestors
16
- end
17
-
18
- return modules
19
-
20
- end
21
-
22
- end