module-cluster 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +54 -156
- data/README.rdoc +54 -130
- data/lib/module-cluster.rb +20 -16
- data/lib/module-cluster/ModuleCluster.rb +4 -120
- data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +40 -0
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +140 -0
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascades.rb +140 -0
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToClass.rb +140 -0
- data/lib/module-cluster/ModuleCluster/Define/_private_/ClusterStack.rb +28 -0
- data/lib/module-cluster/ModuleCluster/Define/_private_/ModuleCluster.rb +110 -0
- data/lib/module-cluster/ModuleCluster/Define/_private_/ModuleClusterCascades.rb +118 -0
- data/lib/module-cluster/ModuleCluster/Define/_private_/ModuleClusterCascadesToClass.rb +126 -0
- data/spec/ModuleCluster/Define/ModuleClusterCascadesToClass_spec.rb +421 -0
- data/spec/ModuleCluster/Define/ModuleClusterCascades_spec.rb +345 -0
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +275 -0
- data/spec/ModuleCluster/Define/_private_/ClusterStack_spec.rb +24 -0
- data/spec/ModuleCluster/Define/_private_/ModuleClusterCascadesToClass_spec.rb +249 -0
- data/spec/ModuleCluster/Define/_private_/ModuleClusterCascades_spec.rb +223 -0
- data/spec/ModuleCluster/Define/_private_/ModuleCluster_spec.rb +168 -0
- data/spec/ModuleCluster_spec.rb +7 -2549
- metadata +21 -12
- data/lib/module-cluster/ModuleCluster/ExtendSupport.rb +0 -95
- data/lib/module-cluster/ModuleCluster/IncludeExtendSupport.rb +0 -104
- data/lib/module-cluster/ModuleCluster/IncludeSupport.rb +0 -94
- data/lib/module-cluster/ModuleCluster/_private_/IncludeExtendSupport.rb +0 -56
- data/lib/module-cluster/_private_/ModuleCluster.rb +0 -23
- data/spec/ModuleCluster/IncludeExtendSupport_spec.rb +0 -46
@@ -1,126 +1,10 @@
|
|
1
1
|
|
2
2
|
module ModuleCluster
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
include ModuleCluster::Define::ModuleCluster
|
5
|
+
include ModuleCluster::Define::ModuleClusterCascades
|
6
|
+
include ModuleCluster::Define::ModuleClusterCascadesToClass
|
7
7
|
|
8
|
-
|
9
|
-
inclusion_array, extension_array = yield_for_includes_extends( Array::ClassOrModule.new, Array::ClassOrModule.new, include_extend_block )
|
10
|
-
ModuleCluster::IncludeSupport.add_includes_for_class_or_module( self, inclusion_array )
|
11
|
-
ModuleCluster::IncludeSupport.add_extends_for_class_or_module( self, extension_array )
|
12
|
-
extend ModuleCluster::IncludeSupport
|
13
|
-
return self
|
14
|
-
end
|
15
|
-
|
16
|
-
############################
|
17
|
-
# define_module_extended #
|
18
|
-
############################
|
19
|
-
|
20
|
-
def define_module_extended( & include_extend_block )
|
21
|
-
inclusion_array, extension_array = yield_for_includes_extends( Array::ClassOrModule.new, Array::ClassOrModule.new, include_extend_block )
|
22
|
-
ModuleCluster::ExtendSupport.add_includes_for_class_or_module( self, inclusion_array )
|
23
|
-
ModuleCluster::ExtendSupport.add_extends_for_class_or_module( self, extension_array )
|
24
|
-
extend ModuleCluster::ExtendSupport
|
25
|
-
return self
|
26
|
-
end
|
27
|
-
|
28
|
-
###########################
|
29
|
-
# define_module_cluster #
|
30
|
-
###########################
|
31
|
-
|
32
|
-
def define_module_cluster( & include_extend_block )
|
33
|
-
define_module_included( & include_extend_block )
|
34
|
-
define_module_extended( & include_extend_block )
|
35
|
-
return self
|
36
|
-
end
|
37
|
-
|
38
|
-
#####################################
|
39
|
-
# define_module_included_cascades #
|
40
|
-
#####################################
|
41
|
-
|
42
|
-
def define_module_included_cascades( & include_extend_block )
|
43
|
-
# any time we are included or extended in a module we want to add cascading extends:
|
44
|
-
# * to the module cascading includes
|
45
|
-
# any time we are included in a class we want to add cascading extends
|
46
|
-
# * to the class
|
47
|
-
inclusion_array, extension_array = yield_for_includes_extends( Array::CascadeToClassOrModule.new, Array::CascadeToClassOrModule.new, include_extend_block )
|
48
|
-
ModuleCluster::IncludeSupport.add_cascading_includes_for_class_or_module( self, inclusion_array )
|
49
|
-
ModuleCluster::IncludeSupport.add_cascading_extends_for_class_or_module( self, extension_array )
|
50
|
-
extend ModuleCluster::IncludeSupport
|
51
|
-
return inclusion_array, extension_array
|
52
|
-
end
|
53
|
-
|
54
|
-
#####################################
|
55
|
-
# define_module_extended_cascades #
|
56
|
-
#####################################
|
57
|
-
|
58
|
-
def define_module_extended_cascades( & include_extend_block )
|
59
|
-
# any time we are included or extended in a module we want to add cascading extends:
|
60
|
-
# * to the module cascading extends
|
61
|
-
# any time we are extended in a class we want to add cascading extends
|
62
|
-
# * to the class
|
63
|
-
inclusion_array, extension_array = yield_for_includes_extends( Array::CascadeToClassOrModule.new, Array::CascadeToClassOrModule.new, include_extend_block )
|
64
|
-
ModuleCluster::ExtendSupport.add_cascading_includes_for_class_or_module( self, inclusion_array )
|
65
|
-
ModuleCluster::ExtendSupport.add_cascading_extends_for_class_or_module( self, extension_array )
|
66
|
-
extend ModuleCluster::ExtendSupport
|
67
|
-
return inclusion_array, extension_array
|
68
|
-
end
|
69
|
-
|
70
|
-
####################################
|
71
|
-
# define_module_cluster_cascades #
|
72
|
-
####################################
|
73
|
-
|
74
|
-
def define_module_cluster_cascades( & include_extend_block )
|
75
|
-
include_includes, include_extends = define_module_included_cascades( & include_extend_block )
|
76
|
-
extend_includes, extend_extends = define_module_extended_cascades( & include_extend_block )
|
77
|
-
ModuleCluster::IncludeSupport.set_as_cluster( self, include_includes, include_extends )
|
78
|
-
ModuleCluster::ExtendSupport.set_as_cluster( self, extend_includes, extend_extends )
|
79
|
-
return self
|
80
|
-
end
|
81
|
-
|
82
|
-
##############################################
|
83
|
-
# define_module_included_cascades_to_class #
|
84
|
-
##############################################
|
85
|
-
|
86
|
-
def define_module_included_cascades_to_class( & include_extend_block )
|
87
|
-
# any time we are included or extended in a module we want to add cascading extends:
|
88
|
-
# * to the module cascading includes
|
89
|
-
# any time we are included in a class we want to add cascading extends
|
90
|
-
# * to the class
|
91
|
-
inclusion_array, extension_array = yield_for_includes_extends( Array::CascadeToClass.new, Array::CascadeToClass.new, include_extend_block )
|
92
|
-
ModuleCluster::IncludeSupport.add_cascading_includes_for_class( self, inclusion_array )
|
93
|
-
ModuleCluster::IncludeSupport.add_cascading_extends_for_class( self, extension_array )
|
94
|
-
extend ModuleCluster::IncludeSupport
|
95
|
-
return inclusion_array, extension_array
|
96
|
-
end
|
97
|
-
|
98
|
-
##############################################
|
99
|
-
# define_module_extended_cascades_to_class #
|
100
|
-
##############################################
|
101
|
-
|
102
|
-
def define_module_extended_cascades_to_class( & include_extend_block )
|
103
|
-
# any time we are included or extended in a module we want to add cascading extends:
|
104
|
-
# * to the module cascading extends
|
105
|
-
# any time we are extended in a class we want to add cascading extends
|
106
|
-
# * to the class
|
107
|
-
inclusion_array, extension_array = yield_for_includes_extends( Array::CascadeToClass.new, Array::CascadeToClass.new, include_extend_block )
|
108
|
-
ModuleCluster::ExtendSupport.add_cascading_includes_for_class( self, inclusion_array )
|
109
|
-
ModuleCluster::ExtendSupport.add_cascading_extends_for_class( self, extension_array )
|
110
|
-
extend ModuleCluster::ExtendSupport
|
111
|
-
return inclusion_array, extension_array
|
112
|
-
end
|
113
|
-
|
114
|
-
#############################################
|
115
|
-
# define_module_cluster_cascades_to_class #
|
116
|
-
#############################################
|
117
|
-
|
118
|
-
def define_module_cluster_cascades_to_class( & include_extend_block )
|
119
|
-
include_includes, include_extends = define_module_included_cascades_to_class( & include_extend_block )
|
120
|
-
extend_includes, extend_extends = define_module_extended_cascades_to_class( & include_extend_block )
|
121
|
-
ModuleCluster::IncludeSupport.set_as_cluster( self, include_includes, include_extends )
|
122
|
-
ModuleCluster::ExtendSupport.set_as_cluster( self, extend_includes, extend_extends )
|
123
|
-
return self
|
124
|
-
end
|
8
|
+
include ModuleCluster::Define::Deprecated
|
125
9
|
|
126
10
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
module ModuleCluster::Define::Deprecated
|
3
|
+
|
4
|
+
def define_module_included
|
5
|
+
raise NoMethodError, 'This method has been replaced by :include_also_includes and :include_also_extends.'
|
6
|
+
end
|
7
|
+
|
8
|
+
def define_module_extended
|
9
|
+
raise NoMethodError, 'This method has been replaced by :extend_also_includes and :extend_also_extends.'
|
10
|
+
end
|
11
|
+
|
12
|
+
def define_module_cluster
|
13
|
+
raise NoMethodError, 'This method has been replaced by :include_also_includes_and_extends and :extend_also_includes_and_extends.'
|
14
|
+
end
|
15
|
+
|
16
|
+
def define_module_included_cascades
|
17
|
+
raise NoMethodError, 'This method has been replaced by :include_cascades_includes and :include_cascades_extends.'
|
18
|
+
end
|
19
|
+
|
20
|
+
def define_module_extended_cascades
|
21
|
+
raise NoMethodError, 'This method has been replaced by :extend_cascades_includes and :extend_cascades_extends.'
|
22
|
+
end
|
23
|
+
|
24
|
+
def define_module_cluster_cascades
|
25
|
+
raise NoMethodError, 'This method has been replaced by :include_cascades_includes_and_extends and :extend_cascades_includes_and_extends.'
|
26
|
+
end
|
27
|
+
|
28
|
+
def define_module_included_cascades_to_class
|
29
|
+
raise NoMethodError, 'This method has been replaced by :include_cascades_includes_to_class and :include_cascades_extends_to_class.'
|
30
|
+
end
|
31
|
+
|
32
|
+
def define_module_extended_cascades_to_class
|
33
|
+
raise NoMethodError, 'This method has been replaced by :extend_cascades_includes_to_class and :extend_cascades_extends_to_class.'
|
34
|
+
end
|
35
|
+
|
36
|
+
def define_module_cluster_cascades_to_class
|
37
|
+
raise NoMethodError, 'This method has been replaced by :include_cascades_includes_and_extends_to_class and :extend_cascades_includes_and_extends_to_class.'
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
|
2
|
+
module ModuleCluster::Define::ModuleCluster
|
3
|
+
|
4
|
+
###########################
|
5
|
+
# include_also_includes #
|
6
|
+
###########################
|
7
|
+
|
8
|
+
def include_also_includes( *includes )
|
9
|
+
includes_module = anonymous_module_included( :include, *includes )
|
10
|
+
clusterstack_module do
|
11
|
+
include( includes_module )
|
12
|
+
end
|
13
|
+
return self
|
14
|
+
end
|
15
|
+
|
16
|
+
##########################
|
17
|
+
# include_also_extends #
|
18
|
+
##########################
|
19
|
+
|
20
|
+
def include_also_extends( *extends )
|
21
|
+
extends_module = anonymous_module_included( :extend, *extends )
|
22
|
+
clusterstack_module do
|
23
|
+
include( extends_module )
|
24
|
+
end
|
25
|
+
return self
|
26
|
+
end
|
27
|
+
|
28
|
+
#######################################
|
29
|
+
# include_also_includes_and_extends #
|
30
|
+
#######################################
|
31
|
+
|
32
|
+
def include_also_includes_and_extends( *includes_and_extends )
|
33
|
+
include_also_includes( *includes_and_extends )
|
34
|
+
include_also_extends( *includes_and_extends )
|
35
|
+
return self
|
36
|
+
end
|
37
|
+
|
38
|
+
##########################
|
39
|
+
# extend_also_includes #
|
40
|
+
##########################
|
41
|
+
|
42
|
+
def extend_also_includes( *includes )
|
43
|
+
includes_module = anonymous_module_extended( :include, *includes )
|
44
|
+
clusterstack_module do
|
45
|
+
include( includes_module )
|
46
|
+
end
|
47
|
+
return self
|
48
|
+
end
|
49
|
+
|
50
|
+
#########################
|
51
|
+
# extend_also_extends #
|
52
|
+
#########################
|
53
|
+
|
54
|
+
def extend_also_extends( *extends )
|
55
|
+
extends_module = anonymous_module_extended( :extend, *extends )
|
56
|
+
clusterstack_module do
|
57
|
+
include( extends_module )
|
58
|
+
end
|
59
|
+
return self
|
60
|
+
end
|
61
|
+
|
62
|
+
######################################
|
63
|
+
# extend_also_includes_and_extends #
|
64
|
+
######################################
|
65
|
+
|
66
|
+
def extend_also_includes_and_extends( *includes_and_extends )
|
67
|
+
extend_also_includes( *includes_and_extends )
|
68
|
+
extend_also_extends( *includes_and_extends )
|
69
|
+
return self
|
70
|
+
end
|
71
|
+
|
72
|
+
###############################
|
73
|
+
# include_prepends_includes #
|
74
|
+
###############################
|
75
|
+
|
76
|
+
def include_prepends_includes( *includes )
|
77
|
+
includes_module = anonymous_module_append_features( :include, *includes )
|
78
|
+
clusterstack_module do
|
79
|
+
include( includes_module )
|
80
|
+
end
|
81
|
+
return self
|
82
|
+
end
|
83
|
+
|
84
|
+
##############################
|
85
|
+
# include_prepends_extends #
|
86
|
+
##############################
|
87
|
+
|
88
|
+
def include_prepends_extends( *extends )
|
89
|
+
extends_module = anonymous_module_append_features( :extend, *extends )
|
90
|
+
clusterstack_module do
|
91
|
+
include( extends_module )
|
92
|
+
end
|
93
|
+
return self
|
94
|
+
end
|
95
|
+
|
96
|
+
###########################################
|
97
|
+
# include_prepends_includes_and_extends #
|
98
|
+
###########################################
|
99
|
+
|
100
|
+
def include_prepends_includes_and_extends( *includes_and_extends )
|
101
|
+
include_prepends_includes( *includes_and_extends )
|
102
|
+
include_prepends_extends( *includes_and_extends )
|
103
|
+
return self
|
104
|
+
end
|
105
|
+
|
106
|
+
##############################
|
107
|
+
# extend_prepends_includes #
|
108
|
+
##############################
|
109
|
+
|
110
|
+
def extend_prepends_includes( *includes )
|
111
|
+
includes_module = anonymous_module_extend_object( :include, *includes )
|
112
|
+
clusterstack_module do
|
113
|
+
include( includes_module )
|
114
|
+
end
|
115
|
+
return self
|
116
|
+
end
|
117
|
+
|
118
|
+
#############################
|
119
|
+
# extend_prepends_extends #
|
120
|
+
#############################
|
121
|
+
|
122
|
+
def extend_prepends_extends( *extends )
|
123
|
+
extends_module = anonymous_module_extend_object( :extend, *extends )
|
124
|
+
clusterstack_module do
|
125
|
+
include( extends_module )
|
126
|
+
end
|
127
|
+
return self
|
128
|
+
end
|
129
|
+
|
130
|
+
##########################################
|
131
|
+
# extend_prepends_includes_and_extends #
|
132
|
+
##########################################
|
133
|
+
|
134
|
+
def extend_prepends_includes_and_extends( *includes_and_extends )
|
135
|
+
extend_prepends_includes( *includes_and_extends )
|
136
|
+
extend_prepends_extends( *includes_and_extends )
|
137
|
+
return self
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
|
2
|
+
module ModuleCluster::Define::ModuleClusterCascades
|
3
|
+
|
4
|
+
###############################
|
5
|
+
# include_cascades_includes #
|
6
|
+
###############################
|
7
|
+
|
8
|
+
def include_cascades_includes( *includes )
|
9
|
+
includes_module = anonymous_module_cascade_included( :include, *includes )
|
10
|
+
clusterstack_module do
|
11
|
+
include( includes_module )
|
12
|
+
end
|
13
|
+
return self
|
14
|
+
end
|
15
|
+
|
16
|
+
##############################
|
17
|
+
# include_cascades_extends #
|
18
|
+
##############################
|
19
|
+
|
20
|
+
def include_cascades_extends( *extends )
|
21
|
+
extends_module = anonymous_module_cascade_included( :extend, *extends )
|
22
|
+
clusterstack_module do
|
23
|
+
include( extends_module )
|
24
|
+
end
|
25
|
+
return self
|
26
|
+
end
|
27
|
+
|
28
|
+
###########################################
|
29
|
+
# include_cascades_includes_and_extends #
|
30
|
+
###########################################
|
31
|
+
|
32
|
+
def include_cascades_includes_and_extends( *includes_and_extends )
|
33
|
+
include_cascades_includes( *includes_and_extends )
|
34
|
+
include_cascades_extends( *includes_and_extends )
|
35
|
+
return self
|
36
|
+
end
|
37
|
+
|
38
|
+
##############################
|
39
|
+
# extend_cascades_includes #
|
40
|
+
##############################
|
41
|
+
|
42
|
+
def extend_cascades_includes( *includes )
|
43
|
+
includes_module = anonymous_module_cascade_extended( :include, *includes )
|
44
|
+
clusterstack_module do
|
45
|
+
include( includes_module )
|
46
|
+
end
|
47
|
+
return self
|
48
|
+
end
|
49
|
+
|
50
|
+
#############################
|
51
|
+
# extend_cascades_extends #
|
52
|
+
#############################
|
53
|
+
|
54
|
+
def extend_cascades_extends( *extends )
|
55
|
+
extends_module = anonymous_module_cascade_extended( :extend, *extends )
|
56
|
+
clusterstack_module do
|
57
|
+
include( extends_module )
|
58
|
+
end
|
59
|
+
return self
|
60
|
+
end
|
61
|
+
|
62
|
+
##########################################
|
63
|
+
# extend_cascades_includes_and_extends #
|
64
|
+
##########################################
|
65
|
+
|
66
|
+
def extend_cascades_includes_and_extends( *includes_and_extends )
|
67
|
+
extend_cascades_includes( *includes_and_extends )
|
68
|
+
extend_cascades_extends( *includes_and_extends )
|
69
|
+
return self
|
70
|
+
end
|
71
|
+
|
72
|
+
##########################################
|
73
|
+
# include_cascades_prepending_includes #
|
74
|
+
##########################################
|
75
|
+
|
76
|
+
def include_cascades_prepending_includes( *includes )
|
77
|
+
includes_module = anonymous_module_cascade_append_features( :include, *includes )
|
78
|
+
clusterstack_module do
|
79
|
+
include( includes_module )
|
80
|
+
end
|
81
|
+
return self
|
82
|
+
end
|
83
|
+
|
84
|
+
#########################################
|
85
|
+
# include_cascades_prepending_extends #
|
86
|
+
#########################################
|
87
|
+
|
88
|
+
def include_cascades_prepending_extends( *extends )
|
89
|
+
extends_module = anonymous_module_cascade_append_features( :extend, *extends )
|
90
|
+
clusterstack_module do
|
91
|
+
include( extends_module )
|
92
|
+
end
|
93
|
+
return self
|
94
|
+
end
|
95
|
+
|
96
|
+
######################################################
|
97
|
+
# include_cascades_prepending_includes_and_extends #
|
98
|
+
######################################################
|
99
|
+
|
100
|
+
def include_cascades_prepending_includes_and_extends( *includes_and_extends )
|
101
|
+
include_cascades_prepending_includes( *includes_and_extends )
|
102
|
+
include_cascades_prepending_extends( *includes_and_extends )
|
103
|
+
return self
|
104
|
+
end
|
105
|
+
|
106
|
+
#########################################
|
107
|
+
# extend_cascades_prepending_includes #
|
108
|
+
#########################################
|
109
|
+
|
110
|
+
def extend_cascades_prepending_includes( *includes )
|
111
|
+
includes_module = anonymous_module_cascade_extend_object( :include, *includes )
|
112
|
+
clusterstack_module do
|
113
|
+
include( includes_module )
|
114
|
+
end
|
115
|
+
return self
|
116
|
+
end
|
117
|
+
|
118
|
+
########################################
|
119
|
+
# extend_cascades_prepending_extends #
|
120
|
+
########################################
|
121
|
+
|
122
|
+
def extend_cascades_prepending_extends( *extends )
|
123
|
+
extends_module = anonymous_module_cascade_extend_object( :extend, *extends )
|
124
|
+
clusterstack_module do
|
125
|
+
include( extends_module )
|
126
|
+
end
|
127
|
+
return self
|
128
|
+
end
|
129
|
+
|
130
|
+
#####################################################
|
131
|
+
# extend_cascades_prepending_includes_and_extends #
|
132
|
+
#####################################################
|
133
|
+
|
134
|
+
def extend_cascades_prepending_includes_and_extends( *includes_and_extends )
|
135
|
+
extend_cascades_prepending_includes( *includes_and_extends )
|
136
|
+
extend_cascades_prepending_extends( *includes_and_extends )
|
137
|
+
return self
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|