module-cluster 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -5
- data/lib/module-cluster/ModuleCluster.rb +6 -6
- data/spec/ModuleCluster_spec.rb +8 -8
- metadata +3 -3
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Adds methods for defining module clusters using #included and #extended.
|
|
8
8
|
|
9
9
|
# Summary #
|
10
10
|
|
11
|
-
Provides :
|
11
|
+
Provides :define_module_included, :define_module_extended, and :define_module_cluster.
|
12
12
|
|
13
13
|
# Install #
|
14
14
|
|
@@ -28,7 +28,7 @@ To cause modules to be included when this module is included:
|
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
module SomeModule
|
31
|
-
|
31
|
+
define_module_included do |includes, extends|
|
32
32
|
includes.concat [ SomeOtherModule ]
|
33
33
|
end
|
34
34
|
end
|
@@ -38,7 +38,7 @@ or extended when this module is included:
|
|
38
38
|
|
39
39
|
```ruby
|
40
40
|
module SomeModule
|
41
|
-
|
41
|
+
define_module_included do |includes, extends|
|
42
42
|
extends.concat [ SomeOtherModule ]
|
43
43
|
end
|
44
44
|
end
|
@@ -48,7 +48,7 @@ or when this module is extended
|
|
48
48
|
|
49
49
|
```ruby
|
50
50
|
module SomeModule
|
51
|
-
|
51
|
+
define_module_extended do |includes, extends|
|
52
52
|
includes.concat [ SomeOtherModule ]
|
53
53
|
end
|
54
54
|
end
|
@@ -58,7 +58,7 @@ or
|
|
58
58
|
|
59
59
|
```ruby
|
60
60
|
module SomeModule
|
61
|
-
|
61
|
+
define_module_extended do |includes, extends|
|
62
62
|
extends.concat [ SomeOtherModule ]
|
63
63
|
end
|
64
64
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
module ModuleCluster
|
3
3
|
|
4
4
|
#############################
|
5
|
-
#
|
5
|
+
# define_module_included #
|
6
6
|
#############################
|
7
7
|
|
8
|
-
def
|
8
|
+
def define_module_included( & block )
|
9
9
|
inclusion_array, extension_array = yield_for_includes_extends( block )
|
10
10
|
ModuleCluster::IncludeSupport.set_includes_for_class_or_module( self, inclusion_array )
|
11
11
|
ModuleCluster::IncludeSupport.set_extends_for_class_or_module( self, extension_array )
|
@@ -14,10 +14,10 @@ module ModuleCluster
|
|
14
14
|
end
|
15
15
|
|
16
16
|
#############################
|
17
|
-
#
|
17
|
+
# define_module_extended #
|
18
18
|
#############################
|
19
19
|
|
20
|
-
def
|
20
|
+
def define_module_extended( & block )
|
21
21
|
inclusion_array, extension_array = yield_for_includes_extends( block )
|
22
22
|
ModuleCluster::ExtendSupport.set_includes_for_class_or_module( self, inclusion_array )
|
23
23
|
ModuleCluster::ExtendSupport.set_extends_for_class_or_module( self, extension_array )
|
@@ -30,8 +30,8 @@ module ModuleCluster
|
|
30
30
|
###########################
|
31
31
|
|
32
32
|
def define_module_cluster( & include_extend_block )
|
33
|
-
|
34
|
-
|
33
|
+
define_module_included( & include_extend_block )
|
34
|
+
define_module_extended( & include_extend_block )
|
35
35
|
return self
|
36
36
|
end
|
37
37
|
|
data/spec/ModuleCluster_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require_relative '../lib/module-cluster.rb'
|
|
3
3
|
describe ModuleCluster do
|
4
4
|
|
5
5
|
#############################
|
6
|
-
#
|
6
|
+
# define_module_included #
|
7
7
|
#############################
|
8
8
|
|
9
9
|
it 'can define includes and extends for module inclusion' do
|
@@ -15,7 +15,7 @@ describe ModuleCluster do
|
|
15
15
|
end
|
16
16
|
module Mock3
|
17
17
|
end
|
18
|
-
|
18
|
+
define_module_included do |includes, extends|
|
19
19
|
includes.concat [ Mock1, Mock2 ]
|
20
20
|
extends.concat [ Mock3 ]
|
21
21
|
end
|
@@ -37,7 +37,7 @@ describe ModuleCluster do
|
|
37
37
|
end
|
38
38
|
module Mock3
|
39
39
|
end
|
40
|
-
|
40
|
+
define_module_included do |includes, extends|
|
41
41
|
includes.concat [ Mock1, Mock2 ]
|
42
42
|
end
|
43
43
|
end
|
@@ -58,7 +58,7 @@ describe ModuleCluster do
|
|
58
58
|
end
|
59
59
|
module Mock3
|
60
60
|
end
|
61
|
-
|
61
|
+
define_module_included do |includes, extends|
|
62
62
|
extends.concat [ Mock3 ]
|
63
63
|
end
|
64
64
|
end
|
@@ -74,7 +74,7 @@ describe ModuleCluster do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
#############################
|
77
|
-
#
|
77
|
+
# define_module_extended #
|
78
78
|
#############################
|
79
79
|
|
80
80
|
it 'can define includes and extends for module extension' do
|
@@ -86,7 +86,7 @@ describe ModuleCluster do
|
|
86
86
|
end
|
87
87
|
module Mock3
|
88
88
|
end
|
89
|
-
|
89
|
+
define_module_extended do |includes, extends|
|
90
90
|
includes.concat [ Mock1, Mock2 ]
|
91
91
|
extends.concat [ Mock3 ]
|
92
92
|
end
|
@@ -108,7 +108,7 @@ describe ModuleCluster do
|
|
108
108
|
end
|
109
109
|
module Mock3
|
110
110
|
end
|
111
|
-
|
111
|
+
define_module_extended do |includes, extends|
|
112
112
|
includes.concat [ Mock1, Mock2 ]
|
113
113
|
end
|
114
114
|
end
|
@@ -129,7 +129,7 @@ describe ModuleCluster do
|
|
129
129
|
end
|
130
130
|
module Mock3
|
131
131
|
end
|
132
|
-
|
132
|
+
define_module_extended do |includes, extends|
|
133
133
|
extends.concat [ Mock3 ]
|
134
134
|
end
|
135
135
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Asher
|
@@ -18,7 +18,7 @@ date: 2011-07-21 00:00:00 -04:00
|
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description: Provides :
|
21
|
+
description: Provides :define_module_included, :define_module_extended, and :define_module_cluster.
|
22
22
|
email: asher@ridiculouspower.com
|
23
23
|
executables: []
|
24
24
|
|