module-cluster 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/module-cluster.rb +3 -0
- data/lib/module-cluster/ModuleCluster.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +41 -48
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascades.rb +53 -64
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToClass.rb +53 -64
- data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToModule.rb +57 -80
- metadata +3 -3
data/lib/module-cluster.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
|
2
2
|
module ModuleCluster
|
3
|
+
module Eigenclass
|
4
|
+
end
|
3
5
|
module Define
|
4
6
|
module AnonymousModule
|
5
7
|
end
|
@@ -27,3 +29,4 @@ require_relative 'module-cluster/ModuleCluster/Define/ModuleClusterCascadesToCla
|
|
27
29
|
require_relative 'module-cluster/ModuleCluster/Define/ModuleClusterCascadesToModule.rb'
|
28
30
|
require_relative 'module-cluster/ModuleCluster/Define/Deprecated.rb'
|
29
31
|
require_relative 'module-cluster/ModuleCluster.rb'
|
32
|
+
|
@@ -3,17 +3,38 @@ module ModuleCluster::Define::ModuleCluster
|
|
3
3
|
|
4
4
|
include ModuleCluster::Define::AnonymousModule
|
5
5
|
|
6
|
+
########################
|
7
|
+
# self.include_block #
|
8
|
+
########################
|
9
|
+
|
10
|
+
def self.include_block( *includes )
|
11
|
+
return Proc.new do
|
12
|
+
unless ( includes -= ancestors ).empty?
|
13
|
+
include( *includes.reverse )
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
#######################
|
19
|
+
# self.extend_block #
|
20
|
+
#######################
|
21
|
+
|
22
|
+
def self.extend_block( *extends )
|
23
|
+
return Proc.new do
|
24
|
+
eigenclass = class << self ; self ; end
|
25
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
26
|
+
extend( *extends.reverse )
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
6
31
|
###########################
|
7
32
|
# include_also_includes #
|
8
33
|
###########################
|
9
34
|
|
10
35
|
def include_also_includes( *includes )
|
11
|
-
|
12
|
-
|
13
|
-
include( *includes.reverse )
|
14
|
-
end
|
15
|
-
clusterstack_module { include( includes_module ) }
|
16
|
-
end
|
36
|
+
includes_module = anonymous_module_for_included( & ModuleCluster::Define::ModuleCluster.include_block( *includes ) )
|
37
|
+
clusterstack_module { include( includes_module ) }
|
17
38
|
return self
|
18
39
|
end
|
19
40
|
|
@@ -22,12 +43,8 @@ module ModuleCluster::Define::ModuleCluster
|
|
22
43
|
##########################
|
23
44
|
|
24
45
|
def include_also_extends( *extends )
|
25
|
-
|
26
|
-
|
27
|
-
extend( *extends.reverse )
|
28
|
-
end
|
29
|
-
clusterstack_module { include( extends_module ) }
|
30
|
-
end
|
46
|
+
extends_module = anonymous_module_for_included( & ModuleCluster::Define::ModuleCluster.extend_block( *extends ) )
|
47
|
+
clusterstack_module { include( extends_module ) }
|
31
48
|
return self
|
32
49
|
end
|
33
50
|
|
@@ -46,12 +63,8 @@ module ModuleCluster::Define::ModuleCluster
|
|
46
63
|
##########################
|
47
64
|
|
48
65
|
def extend_also_includes( *includes )
|
49
|
-
|
50
|
-
|
51
|
-
include( *includes.reverse )
|
52
|
-
end
|
53
|
-
clusterstack_module { include( includes_module ) }
|
54
|
-
end
|
66
|
+
includes_module = anonymous_module_for_extended( & ModuleCluster::Define::ModuleCluster.include_block( *includes ) )
|
67
|
+
clusterstack_module { include( includes_module ) }
|
55
68
|
return self
|
56
69
|
end
|
57
70
|
|
@@ -60,12 +73,8 @@ module ModuleCluster::Define::ModuleCluster
|
|
60
73
|
#########################
|
61
74
|
|
62
75
|
def extend_also_extends( *extends )
|
63
|
-
|
64
|
-
|
65
|
-
extend( *extends.reverse )
|
66
|
-
end
|
67
|
-
clusterstack_module { include( extends_module ) }
|
68
|
-
end
|
76
|
+
extends_module = anonymous_module_for_extended( & ModuleCluster::Define::ModuleCluster.extend_block( *extends ) )
|
77
|
+
clusterstack_module { include( extends_module ) }
|
69
78
|
return self
|
70
79
|
end
|
71
80
|
|
@@ -84,12 +93,8 @@ module ModuleCluster::Define::ModuleCluster
|
|
84
93
|
###############################
|
85
94
|
|
86
95
|
def include_prepends_includes( *includes )
|
87
|
-
|
88
|
-
|
89
|
-
include( *includes.reverse )
|
90
|
-
end
|
91
|
-
clusterstack_module { include( includes_module ) }
|
92
|
-
end
|
96
|
+
includes_module = anonymous_module_for_append_features( & ModuleCluster::Define::ModuleCluster.include_block( *includes ) )
|
97
|
+
clusterstack_module { include( includes_module ) }
|
93
98
|
return self
|
94
99
|
end
|
95
100
|
|
@@ -98,12 +103,8 @@ module ModuleCluster::Define::ModuleCluster
|
|
98
103
|
##############################
|
99
104
|
|
100
105
|
def include_prepends_extends( *extends )
|
101
|
-
|
102
|
-
|
103
|
-
extend( *extends.reverse )
|
104
|
-
end
|
105
|
-
clusterstack_module { include( extends_module ) }
|
106
|
-
end
|
106
|
+
extends_module = anonymous_module_for_append_features( & ModuleCluster::Define::ModuleCluster.extend_block( *extends ) )
|
107
|
+
clusterstack_module { include( extends_module ) }
|
107
108
|
return self
|
108
109
|
end
|
109
110
|
|
@@ -122,12 +123,8 @@ module ModuleCluster::Define::ModuleCluster
|
|
122
123
|
##############################
|
123
124
|
|
124
125
|
def extend_prepends_includes( *includes )
|
125
|
-
|
126
|
-
|
127
|
-
include( *includes.reverse )
|
128
|
-
end
|
129
|
-
clusterstack_module { include( includes_module ) }
|
130
|
-
end
|
126
|
+
includes_module = anonymous_module_for_extend_object( & ModuleCluster::Define::ModuleCluster.include_block( *includes ) )
|
127
|
+
clusterstack_module { include( includes_module ) }
|
131
128
|
return self
|
132
129
|
end
|
133
130
|
|
@@ -136,12 +133,8 @@ module ModuleCluster::Define::ModuleCluster
|
|
136
133
|
#############################
|
137
134
|
|
138
135
|
def extend_prepends_extends( *extends )
|
139
|
-
|
140
|
-
|
141
|
-
extend( *extends.reverse )
|
142
|
-
end
|
143
|
-
clusterstack_module { include( extends_module ) }
|
144
|
-
end
|
136
|
+
extends_module = anonymous_module_for_extend_object( & ModuleCluster::Define::ModuleCluster.extend_block( *extends ) )
|
137
|
+
clusterstack_module { include( extends_module ) }
|
145
138
|
return self
|
146
139
|
end
|
147
140
|
|
@@ -2,20 +2,44 @@
|
|
2
2
|
module ModuleCluster::Define::ModuleClusterCascades
|
3
3
|
|
4
4
|
include ModuleCluster::Define::AnonymousModule
|
5
|
+
|
6
|
+
########################
|
7
|
+
# self.include_block #
|
8
|
+
########################
|
9
|
+
|
10
|
+
def self.include_block( cascade_method, *includes )
|
11
|
+
return Proc.new do
|
12
|
+
unless ( includes -= ancestors ).empty?
|
13
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
14
|
+
__send__( cascade_method, *includes )
|
15
|
+
include( *includes.reverse )
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
#######################
|
21
|
+
# self.extend_block #
|
22
|
+
#######################
|
23
|
+
|
24
|
+
def self.extend_block( cascade_method, *extends )
|
25
|
+
return Proc.new do
|
26
|
+
eigenclass = class << self ; self ; end
|
27
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
28
|
+
extend ModuleCluster::Define::ModuleClusterCascades
|
29
|
+
__send__( cascade_method, *extends )
|
30
|
+
extend( *extends.reverse )
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
5
34
|
|
6
35
|
###############################
|
7
36
|
# include_cascades_includes #
|
8
37
|
###############################
|
9
38
|
|
10
39
|
def include_cascades_includes( *includes )
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
include_cascades_includes( *includes )
|
15
|
-
include( *includes.reverse )
|
16
|
-
end
|
17
|
-
clusterstack_module { include( includes_module ) }
|
18
|
-
end
|
40
|
+
include_block = ModuleCluster::Define::ModuleClusterCascades.include_block( :include_cascades_includes, *includes )
|
41
|
+
includes_module = anonymous_module_for_included( 'Cascades', & include_block )
|
42
|
+
clusterstack_module { include( includes_module ) }
|
19
43
|
return self
|
20
44
|
end
|
21
45
|
|
@@ -24,14 +48,9 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
24
48
|
##############################
|
25
49
|
|
26
50
|
def include_cascades_extends( *extends )
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
include_cascades_extends( *extends )
|
31
|
-
extend( *extends.reverse )
|
32
|
-
end
|
33
|
-
clusterstack_module { include( extends_module ) }
|
34
|
-
end
|
51
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascades.extend_block( :include_cascades_extends, *extends )
|
52
|
+
extends_module = anonymous_module_for_included( 'Cascades', & extend_block )
|
53
|
+
clusterstack_module { include( extends_module ) }
|
35
54
|
return self
|
36
55
|
end
|
37
56
|
|
@@ -50,14 +69,9 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
50
69
|
##############################
|
51
70
|
|
52
71
|
def extend_cascades_includes( *includes )
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
extend_cascades_includes( *includes )
|
57
|
-
include( *includes.reverse )
|
58
|
-
end
|
59
|
-
clusterstack_module { include( includes_module ) }
|
60
|
-
end
|
72
|
+
include_block = ModuleCluster::Define::ModuleClusterCascades.include_block( :extend_cascades_includes, *includes )
|
73
|
+
includes_module = anonymous_module_for_extended( 'Cascades', & include_block )
|
74
|
+
clusterstack_module { include( includes_module ) }
|
61
75
|
return self
|
62
76
|
end
|
63
77
|
|
@@ -66,14 +80,9 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
66
80
|
#############################
|
67
81
|
|
68
82
|
def extend_cascades_extends( *extends )
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
extend_cascades_extends( *extends )
|
73
|
-
extend( *extends.reverse )
|
74
|
-
end
|
75
|
-
clusterstack_module { include( extends_module ) }
|
76
|
-
end
|
83
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascades.extend_block( :extend_cascades_extends, *extends )
|
84
|
+
extends_module = anonymous_module_for_extended( 'Cascades', & extend_block )
|
85
|
+
clusterstack_module { include( extends_module ) }
|
77
86
|
return self
|
78
87
|
end
|
79
88
|
|
@@ -92,14 +101,9 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
92
101
|
##########################################
|
93
102
|
|
94
103
|
def include_cascades_prepending_includes( *includes )
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
include_cascades_prepending_includes( *includes )
|
99
|
-
include( *includes.reverse )
|
100
|
-
end
|
101
|
-
clusterstack_module { include( includes_module ) }
|
102
|
-
end
|
104
|
+
include_block = ModuleCluster::Define::ModuleClusterCascades.include_block( :include_cascades_prepending_includes, *includes )
|
105
|
+
includes_module = anonymous_module_for_append_features( 'Cascades', & include_block )
|
106
|
+
clusterstack_module { include( includes_module ) }
|
103
107
|
return self
|
104
108
|
end
|
105
109
|
|
@@ -108,14 +112,9 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
108
112
|
#########################################
|
109
113
|
|
110
114
|
def include_cascades_prepending_extends( *extends )
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
include_cascades_prepending_extends( *extends )
|
115
|
-
extend( *extends.reverse )
|
116
|
-
end
|
117
|
-
clusterstack_module { include( extends_module ) }
|
118
|
-
end
|
115
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascades.extend_block( :include_cascades_prepending_extends, *extends )
|
116
|
+
extends_module = anonymous_module_for_append_features( 'Cascades', & extend_block )
|
117
|
+
clusterstack_module { include( extends_module ) }
|
119
118
|
return self
|
120
119
|
end
|
121
120
|
|
@@ -134,14 +133,9 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
134
133
|
#########################################
|
135
134
|
|
136
135
|
def extend_cascades_prepending_includes( *includes )
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
extend_cascades_prepending_includes( *includes )
|
141
|
-
include( *includes.reverse )
|
142
|
-
end
|
143
|
-
clusterstack_module { include( includes_module ) }
|
144
|
-
end
|
136
|
+
include_block = ModuleCluster::Define::ModuleClusterCascades.include_block( :extend_cascades_prepending_includes, *includes )
|
137
|
+
includes_module = anonymous_module_for_extend_object( 'Cascades', & include_block )
|
138
|
+
clusterstack_module { include( includes_module ) }
|
145
139
|
return self
|
146
140
|
end
|
147
141
|
|
@@ -150,14 +144,9 @@ module ModuleCluster::Define::ModuleClusterCascades
|
|
150
144
|
########################################
|
151
145
|
|
152
146
|
def extend_cascades_prepending_extends( *extends )
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
extend_cascades_prepending_extends( *extends )
|
157
|
-
extend( *extends.reverse )
|
158
|
-
end
|
159
|
-
clusterstack_module { include( extends_module ) }
|
160
|
-
end
|
147
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascades.extend_block( :extend_cascades_prepending_extends, *extends )
|
148
|
+
extends_module = anonymous_module_for_extend_object( 'Cascades', & extend_block )
|
149
|
+
clusterstack_module { include( extends_module ) }
|
161
150
|
return self
|
162
151
|
end
|
163
152
|
|
@@ -3,19 +3,43 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
3
3
|
|
4
4
|
include ModuleCluster::Define::AnonymousModule
|
5
5
|
|
6
|
+
########################
|
7
|
+
# self.include_block #
|
8
|
+
########################
|
9
|
+
|
10
|
+
def self.include_block( cascade_method, *includes )
|
11
|
+
return Proc.new do
|
12
|
+
unless ( includes -= ancestors ).empty?
|
13
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
14
|
+
__send__( cascade_method, *includes )
|
15
|
+
include( *includes.reverse ) if is_a?( Class )
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
#######################
|
21
|
+
# self.extend_block #
|
22
|
+
#######################
|
23
|
+
|
24
|
+
def self.extend_block( cascade_method, *extends )
|
25
|
+
return Proc.new do
|
26
|
+
eigenclass = class << self ; self ; end
|
27
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
28
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToClass
|
29
|
+
__send__( cascade_method, *extends )
|
30
|
+
extend( *extends.reverse ) if is_a?( Class )
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
6
35
|
########################################
|
7
36
|
# include_cascades_includes_to_class #
|
8
37
|
########################################
|
9
38
|
|
10
39
|
def include_cascades_includes_to_class( *includes )
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
include_cascades_includes_to_class( *includes )
|
15
|
-
include( *includes.reverse ) if is_a?( Class )
|
16
|
-
end
|
17
|
-
clusterstack_module { include( includes_module ) }
|
18
|
-
end
|
40
|
+
include_block = ModuleCluster::Define::ModuleClusterCascadesToClass.include_block( :include_cascades_includes_to_class, *includes )
|
41
|
+
includes_module = anonymous_module_for_included( 'CascadesToClass', & include_block )
|
42
|
+
clusterstack_module { include( includes_module ) }
|
19
43
|
return self
|
20
44
|
end
|
21
45
|
|
@@ -24,14 +48,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
24
48
|
#######################################
|
25
49
|
|
26
50
|
def include_cascades_extends_to_class( *extends )
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
include_cascades_extends_to_class( *extends )
|
31
|
-
extend( *extends.reverse ) if is_a?( Class )
|
32
|
-
end
|
33
|
-
clusterstack_module { include( extends_module ) }
|
34
|
-
end
|
51
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascadesToClass.extend_block( :include_cascades_extends_to_class, *extends )
|
52
|
+
extends_module = anonymous_module_for_included( 'CascadesToClass', & extend_block )
|
53
|
+
clusterstack_module { include( extends_module ) }
|
35
54
|
return self
|
36
55
|
end
|
37
56
|
|
@@ -50,14 +69,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
50
69
|
#######################################
|
51
70
|
|
52
71
|
def extend_cascades_includes_to_class( *includes )
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
extend_cascades_includes_to_class( *includes )
|
57
|
-
include( *includes.reverse ) if is_a?( Class )
|
58
|
-
end
|
59
|
-
clusterstack_module { include( includes_module ) }
|
60
|
-
end
|
72
|
+
include_block = ModuleCluster::Define::ModuleClusterCascadesToClass.include_block( :extend_cascades_includes_to_class, *includes )
|
73
|
+
includes_module = anonymous_module_for_extended( 'CascadesToClass', & include_block )
|
74
|
+
clusterstack_module { include( includes_module ) }
|
61
75
|
return self
|
62
76
|
end
|
63
77
|
|
@@ -66,14 +80,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
66
80
|
######################################
|
67
81
|
|
68
82
|
def extend_cascades_extends_to_class( *extends )
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
extend_cascades_extends_to_class( *extends )
|
73
|
-
extend( *extends.reverse ) if is_a?( Class )
|
74
|
-
end
|
75
|
-
clusterstack_module { include( extends_module ) }
|
76
|
-
end
|
83
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascadesToClass.extend_block( :extend_cascades_extends_to_class, *extends )
|
84
|
+
extends_module = anonymous_module_for_extended( 'CascadesToClass', & extend_block )
|
85
|
+
clusterstack_module { include( extends_module ) }
|
77
86
|
return self
|
78
87
|
end
|
79
88
|
|
@@ -92,14 +101,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
92
101
|
###################################################
|
93
102
|
|
94
103
|
def include_cascades_to_class_prepending_includes( *includes )
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
include_cascades_to_class_prepending_includes( *includes )
|
99
|
-
include( *includes.reverse ) if is_a?( Class )
|
100
|
-
end
|
101
|
-
clusterstack_module { include( includes_module ) }
|
102
|
-
end
|
104
|
+
include_block = ModuleCluster::Define::ModuleClusterCascadesToClass.include_block( :include_cascades_to_class_prepending_includes, *includes )
|
105
|
+
includes_module = anonymous_module_for_append_features( 'CascadesToClass', & include_block )
|
106
|
+
clusterstack_module { include( includes_module ) }
|
103
107
|
return self
|
104
108
|
end
|
105
109
|
|
@@ -108,14 +112,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
108
112
|
##################################################
|
109
113
|
|
110
114
|
def include_cascades_to_class_prepending_extends( *extends )
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
include_cascades_to_class_prepending_extends( *extends )
|
115
|
-
extend( *extends.reverse ) if is_a?( Class )
|
116
|
-
end
|
117
|
-
clusterstack_module { include( extends_module ) }
|
118
|
-
end
|
115
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascadesToClass.extend_block( :include_cascades_to_class_prepending_extends, *extends )
|
116
|
+
extends_module = anonymous_module_for_append_features( 'CascadesToClass', & extend_block )
|
117
|
+
clusterstack_module { include( extends_module ) }
|
119
118
|
return self
|
120
119
|
end
|
121
120
|
|
@@ -134,14 +133,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
134
133
|
##################################################
|
135
134
|
|
136
135
|
def extend_cascades_to_class_prepending_includes( *includes )
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
extend_cascades_to_class_prepending_includes( *includes )
|
141
|
-
include( *includes.reverse ) if is_a?( Class )
|
142
|
-
end
|
143
|
-
clusterstack_module { include( includes_module ) }
|
144
|
-
end
|
136
|
+
include_block = ModuleCluster::Define::ModuleClusterCascadesToClass.include_block( :extend_cascades_to_class_prepending_includes, *includes )
|
137
|
+
includes_module = anonymous_module_for_extend_object( 'CascadesToClass', & include_block )
|
138
|
+
clusterstack_module { include( includes_module ) }
|
145
139
|
return self
|
146
140
|
end
|
147
141
|
|
@@ -150,14 +144,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToClass
|
|
150
144
|
#################################################
|
151
145
|
|
152
146
|
def extend_cascades_to_class_prepending_extends( *extends )
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
extend_cascades_to_class_prepending_extends( *extends )
|
157
|
-
extend( *extends.reverse ) if is_a?( Class )
|
158
|
-
end
|
159
|
-
clusterstack_module { include( extends_module ) }
|
160
|
-
end
|
147
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascadesToClass.extend_block( :extend_cascades_to_class_prepending_extends, *extends )
|
148
|
+
extends_module = anonymous_module_for_extend_object( 'CascadesToClass', & extend_block )
|
149
|
+
clusterstack_module { include( extends_module ) }
|
161
150
|
return self
|
162
151
|
end
|
163
152
|
|
@@ -3,21 +3,47 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
3
3
|
|
4
4
|
include ModuleCluster::Define::AnonymousModule
|
5
5
|
|
6
|
+
########################
|
7
|
+
# self.include_block #
|
8
|
+
########################
|
9
|
+
|
10
|
+
def self.include_block( cascade_method, *includes )
|
11
|
+
return Proc.new do
|
12
|
+
unless is_a?( Class )
|
13
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
14
|
+
__send__( cascade_method, *includes )
|
15
|
+
unless ( includes -= ancestors ).empty?
|
16
|
+
include( *includes.reverse )
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
#######################
|
23
|
+
# self.extend_block #
|
24
|
+
#######################
|
25
|
+
|
26
|
+
def self.extend_block( cascade_method, *extends )
|
27
|
+
return Proc.new do
|
28
|
+
unless is_a?( Class )
|
29
|
+
eigenclass = class << self ; self ; end
|
30
|
+
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
31
|
+
__send__( cascade_method, *extends )
|
32
|
+
unless ( extends -= eigenclass.ancestors ).empty?
|
33
|
+
extend( *extends.reverse )
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
6
39
|
#########################################
|
7
40
|
# include_cascades_includes_to_module #
|
8
41
|
#########################################
|
9
42
|
|
10
43
|
def include_cascades_includes_to_module( *includes )
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
15
|
-
include_cascades_includes_to_module( *includes )
|
16
|
-
include( *includes.reverse )
|
17
|
-
end
|
18
|
-
end
|
19
|
-
clusterstack_module { include( includes_module ) }
|
20
|
-
end
|
44
|
+
include_block = ModuleCluster::Define::ModuleClusterCascadesToModule.include_block( :include_cascades_includes_to_module, *includes )
|
45
|
+
includes_module = anonymous_module_for_included( 'CascadesToModule', & include_block )
|
46
|
+
clusterstack_module { include( includes_module ) }
|
21
47
|
return self
|
22
48
|
end
|
23
49
|
|
@@ -26,16 +52,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
26
52
|
########################################
|
27
53
|
|
28
54
|
def include_cascades_extends_to_module( *extends )
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
33
|
-
include_cascades_extends_to_module( *extends )
|
34
|
-
extend( *extends.reverse )
|
35
|
-
end
|
36
|
-
end
|
37
|
-
clusterstack_module { include( extends_module ) }
|
38
|
-
end
|
55
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascadesToModule.extend_block( :include_cascades_extends_to_module, *extends )
|
56
|
+
extends_module = anonymous_module_for_included( 'CascadesToModule', & extend_block )
|
57
|
+
clusterstack_module { include( extends_module ) }
|
39
58
|
return self
|
40
59
|
end
|
41
60
|
|
@@ -54,16 +73,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
54
73
|
########################################
|
55
74
|
|
56
75
|
def extend_cascades_includes_to_module( *includes )
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
61
|
-
extend_cascades_includes_to_module( *includes )
|
62
|
-
include( *includes.reverse )
|
63
|
-
end
|
64
|
-
end
|
65
|
-
clusterstack_module { include( includes_module ) }
|
66
|
-
end
|
76
|
+
include_block = ModuleCluster::Define::ModuleClusterCascadesToModule.include_block( :extend_cascades_includes_to_module, *includes )
|
77
|
+
includes_module = anonymous_module_for_extended( 'CascadesToModule', & include_block )
|
78
|
+
clusterstack_module { include( includes_module ) }
|
67
79
|
return self
|
68
80
|
end
|
69
81
|
|
@@ -72,16 +84,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
72
84
|
#######################################
|
73
85
|
|
74
86
|
def extend_cascades_extends_to_module( *extends )
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
79
|
-
extend_cascades_extends_to_module( *extends )
|
80
|
-
extend( *extends.reverse )
|
81
|
-
end
|
82
|
-
end
|
83
|
-
clusterstack_module { include( extends_module ) }
|
84
|
-
end
|
87
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascadesToModule.extend_block( :extend_cascades_extends_to_module, *extends )
|
88
|
+
extends_module = anonymous_module_for_extended( 'CascadesToModule', & extend_block )
|
89
|
+
clusterstack_module { include( extends_module ) }
|
85
90
|
return self
|
86
91
|
end
|
87
92
|
|
@@ -100,16 +105,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
100
105
|
####################################################
|
101
106
|
|
102
107
|
def include_cascades_to_module_prepending_includes( *includes )
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
107
|
-
include_cascades_to_module_prepending_includes( *includes )
|
108
|
-
include( *includes.reverse )
|
109
|
-
end
|
110
|
-
end
|
111
|
-
clusterstack_module { include( includes_module ) }
|
112
|
-
end
|
108
|
+
include_block = ModuleCluster::Define::ModuleClusterCascadesToModule.include_block( :include_cascades_to_module_prepending_includes, *includes )
|
109
|
+
includes_module = anonymous_module_for_append_features( 'CascadesToModule', & include_block )
|
110
|
+
clusterstack_module { include( includes_module ) }
|
113
111
|
return self
|
114
112
|
end
|
115
113
|
|
@@ -118,16 +116,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
118
116
|
###################################################
|
119
117
|
|
120
118
|
def include_cascades_to_module_prepending_extends( *extends )
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
125
|
-
include_cascades_to_module_prepending_extends( *extends )
|
126
|
-
extend( *extends.reverse )
|
127
|
-
end
|
128
|
-
end
|
129
|
-
clusterstack_module { include( extends_module ) }
|
130
|
-
end
|
119
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascadesToModule.extend_block( :include_cascades_to_module_prepending_extends, *extends )
|
120
|
+
extends_module = anonymous_module_for_append_features( 'CascadesToModule', & extend_block )
|
121
|
+
clusterstack_module { include( extends_module ) }
|
131
122
|
return self
|
132
123
|
end
|
133
124
|
|
@@ -146,16 +137,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
146
137
|
###################################################
|
147
138
|
|
148
139
|
def extend_cascades_to_module_prepending_includes( *includes )
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
153
|
-
extend_cascades_to_module_prepending_includes( *includes )
|
154
|
-
include( *includes.reverse )
|
155
|
-
end
|
156
|
-
end
|
157
|
-
clusterstack_module { include( includes_module ) }
|
158
|
-
end
|
140
|
+
include_block = ModuleCluster::Define::ModuleClusterCascadesToModule.include_block( :extend_cascades_to_module_prepending_includes, *includes )
|
141
|
+
includes_module = anonymous_module_for_extend_object( 'CascadesToModule', & include_block )
|
142
|
+
clusterstack_module { include( includes_module ) }
|
159
143
|
return self
|
160
144
|
end
|
161
145
|
|
@@ -164,16 +148,9 @@ module ModuleCluster::Define::ModuleClusterCascadesToModule
|
|
164
148
|
##################################################
|
165
149
|
|
166
150
|
def extend_cascades_to_module_prepending_extends( *extends )
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
extend ModuleCluster::Define::ModuleClusterCascadesToModule
|
171
|
-
extend_cascades_to_module_prepending_extends( *extends )
|
172
|
-
extend( *extends.reverse )
|
173
|
-
end
|
174
|
-
end
|
175
|
-
clusterstack_module { include( extends_module ) }
|
176
|
-
end
|
151
|
+
extend_block = ModuleCluster::Define::ModuleClusterCascadesToModule.extend_block( :extend_cascades_to_module_prepending_extends, *extends )
|
152
|
+
extends_module = anonymous_module_for_extend_object( 'CascadesToModule', & extend_block )
|
153
|
+
clusterstack_module { include( extends_module ) }
|
177
154
|
return self
|
178
155
|
end
|
179
156
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 1.3.
|
8
|
+
- 1
|
9
|
+
version: 1.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Asher
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-08-
|
17
|
+
date: 2011-08-04 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|