paramix 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{HISTORY → HISTORY.rdoc} +16 -0
- data/LICENSE +17 -668
- data/README.rdoc +25 -42
- data/Syckfile +87 -0
- data/lib/paramix.rb +81 -155
- data/meta/version +1 -1
- data/test/nested/test_nested_both.rb +26 -14
- data/test/nested/test_nested_bottom.rb +15 -11
- data/test/nested/test_nested_moot.rb +48 -0
- data/test/nested/test_nested_simple.rb +41 -0
- data/test/nested/test_nested_top.rb +19 -10
- data/test/test_paramix_callback.rb +16 -9
- data/test/test_paramix_extend.rb +7 -3
- data/test/test_paramix_include.rb +7 -3
- data/test/test_paramix_namespace.rb +11 -11
- metadata +10 -7
- data/test/test_paramix_inject.rb +0 -36
data/meta/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
@@ -6,39 +6,51 @@ class TC_Paramix_Nested_Both < Test::Unit::TestCase
|
|
6
6
|
# -- fixture ------------------------------
|
7
7
|
|
8
8
|
module M
|
9
|
-
include Paramix
|
9
|
+
include Paramix::Parametric
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
parameterized do |params|
|
12
|
+
public :f do
|
13
|
+
params[:p]
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
module N
|
17
|
-
include Paramix
|
18
|
-
include M[:p=>"
|
19
|
+
include Paramix::Parametric
|
20
|
+
include M[:p=>"NMp"]
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
parameterized do |params|
|
23
|
+
public :g do
|
24
|
+
params[:p]
|
25
|
+
end
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
25
29
|
class I
|
26
|
-
include N[:p => "
|
30
|
+
include N[:p => "INp"]
|
27
31
|
end
|
28
32
|
|
29
33
|
class E
|
30
|
-
extend N[:p => "
|
34
|
+
extend N[:p => "ENp"]
|
31
35
|
end
|
32
36
|
|
33
37
|
# -- tests --------------------------------
|
34
38
|
|
35
|
-
def
|
36
|
-
assert_equal( "
|
39
|
+
def test_include_f
|
40
|
+
assert_equal( "NMp", I.new.f )
|
37
41
|
end
|
38
42
|
|
39
|
-
|
40
|
-
|
41
|
-
|
43
|
+
def test_include_g
|
44
|
+
assert_equal( "INp", I.new.g )
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_extend_f
|
48
|
+
assert_equal( "NMp", E.f )
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_extend_g
|
52
|
+
assert_equal( "ENp", E.g )
|
53
|
+
end
|
42
54
|
|
43
55
|
end
|
44
56
|
|
@@ -6,45 +6,49 @@ class TC_Paramix_Nested_Bottom < Test::Unit::TestCase
|
|
6
6
|
# -- fixture ------------------------------
|
7
7
|
|
8
8
|
module M
|
9
|
-
include Paramix
|
9
|
+
include Paramix::Parametric
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
parameterized do |params|
|
12
|
+
public :f do
|
13
|
+
params[:p]
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
module N
|
17
19
|
include M
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
parameterized do |params|
|
22
|
+
public :g do
|
23
|
+
params[:p]
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
24
28
|
class I
|
25
|
-
include N[:p => "
|
29
|
+
include N[:p => "INp"]
|
26
30
|
end
|
27
31
|
|
28
32
|
class E
|
29
|
-
extend N[:p => "
|
33
|
+
extend N[:p => "ENp"]
|
30
34
|
end
|
31
35
|
|
32
36
|
# -- tests --------------------------------
|
33
37
|
|
34
38
|
def test_include_f
|
35
|
-
assert_equal( "
|
39
|
+
assert_equal( "INp", I.new.f )
|
36
40
|
end
|
37
41
|
|
38
42
|
def test_include_g
|
39
|
-
assert_equal( "
|
43
|
+
assert_equal( "INp", I.new.g )
|
40
44
|
end
|
41
45
|
|
42
46
|
def test_extend_f
|
43
|
-
assert_equal( "
|
47
|
+
assert_equal( "ENp", E.f )
|
44
48
|
end
|
45
49
|
|
46
50
|
def test_extend_g
|
47
|
-
assert_equal( "
|
51
|
+
assert_equal( "ENp", E.g )
|
48
52
|
end
|
49
53
|
|
50
54
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'paramix'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
class TC_Paramix_Nested_Simple < Test::Unit::TestCase
|
5
|
+
|
6
|
+
# -- fixture ------------------------------
|
7
|
+
|
8
|
+
module M
|
9
|
+
include Paramix::Parametric
|
10
|
+
|
11
|
+
parameterized do |params|
|
12
|
+
public :f do
|
13
|
+
params[:p]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module N
|
19
|
+
include Paramix::Parametric
|
20
|
+
include M[:p=>"NMp"]
|
21
|
+
end
|
22
|
+
|
23
|
+
class I ; include N[] ; end
|
24
|
+
class E ; extend N[] ; end
|
25
|
+
|
26
|
+
class Ix ; include N[:p=>"IxNp"] ; end
|
27
|
+
class Ex ; extend N[:p=>"ExNp"] ; end
|
28
|
+
|
29
|
+
# -- tests --------------------------------
|
30
|
+
|
31
|
+
def test_include_if
|
32
|
+
assert_equal( "NMp", I.new.f )
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_extend_ef
|
36
|
+
assert_equal( "NMp", E.f )
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_include_ixf
|
40
|
+
assert_equal( "NMp", I.new.f )
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_extend_exf
|
44
|
+
assert_equal( "NMp", E.f )
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'paramix'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
class TC_Paramix_Nested_Simple < Test::Unit::TestCase
|
5
|
+
|
6
|
+
# -- fixture ------------------------------
|
7
|
+
|
8
|
+
module M
|
9
|
+
include Paramix::Parametric
|
10
|
+
|
11
|
+
parameterized do |params|
|
12
|
+
public :f do
|
13
|
+
params[:p]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module N
|
19
|
+
include M[:p=>"NMp"]
|
20
|
+
end
|
21
|
+
|
22
|
+
class I
|
23
|
+
include N
|
24
|
+
end
|
25
|
+
|
26
|
+
class E
|
27
|
+
extend N
|
28
|
+
end
|
29
|
+
|
30
|
+
# -- tests --------------------------------
|
31
|
+
|
32
|
+
def test_include_if
|
33
|
+
assert_equal( "NMp", I.new.f )
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_extend_ef
|
37
|
+
assert_equal( "NMp", E.f )
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
@@ -6,27 +6,32 @@ class TC_Paramix_Nested_Top < Test::Unit::TestCase
|
|
6
6
|
# -- fixture ------------------------------
|
7
7
|
|
8
8
|
module M
|
9
|
-
include Paramix
|
9
|
+
include Paramix::Parametric
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
parameterized do |params|
|
12
|
+
public :f do
|
13
|
+
params[:p]
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
module N
|
19
|
+
include Paramix::Parametric
|
17
20
|
include M[:p=>"mood"]
|
18
21
|
|
19
|
-
|
20
|
-
|
22
|
+
parameterized do |params|
|
23
|
+
public :g do
|
24
|
+
params[:p]
|
25
|
+
end
|
21
26
|
end
|
22
27
|
end
|
23
28
|
|
24
29
|
class I
|
25
|
-
include N
|
30
|
+
include N[]
|
26
31
|
end
|
27
32
|
|
28
33
|
class E
|
29
|
-
extend N
|
34
|
+
extend N[]
|
30
35
|
end
|
31
36
|
|
32
37
|
# -- tests --------------------------------
|
@@ -39,9 +44,13 @@ class TC_Paramix_Nested_Top < Test::Unit::TestCase
|
|
39
44
|
assert_equal( nil, I.new.g ) # TODO: or error ?
|
40
45
|
end
|
41
46
|
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
def test_extend_f
|
48
|
+
assert_equal( "mood", E.f )
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_extend_g
|
52
|
+
assert_equal( nil, E.g )
|
53
|
+
end
|
45
54
|
|
46
55
|
end
|
47
56
|
|
@@ -1,24 +1,31 @@
|
|
1
1
|
require 'paramix'
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
|
+
include Paramix
|
5
|
+
|
4
6
|
class TC_Paramix_Callback < Test::Unit::TestCase
|
5
7
|
|
6
8
|
# -- fixture ------------------------------
|
7
9
|
|
8
10
|
module M
|
9
|
-
include
|
11
|
+
include Parametric
|
10
12
|
|
11
|
-
|
12
|
-
mixin_param(M,:p)
|
13
|
-
end
|
13
|
+
parameterized do |params|
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
base.class_eval do
|
18
|
-
attr_accessor mixin_parameters[M][:p]
|
15
|
+
public :f do
|
16
|
+
params[:p]
|
19
17
|
end
|
20
|
-
|
18
|
+
|
19
|
+
attr_accessor params[:p]
|
21
20
|
end
|
21
|
+
|
22
|
+
#
|
23
|
+
#def self.included(base)
|
24
|
+
# base.class_eval do
|
25
|
+
# attr_accessor mixin_parameters[M][:p]
|
26
|
+
# end
|
27
|
+
# super(base)
|
28
|
+
#end
|
22
29
|
end
|
23
30
|
|
24
31
|
class C1
|
data/test/test_paramix_extend.rb
CHANGED
@@ -6,10 +6,14 @@ class TC_Paramix_Extend < Test::Unit::TestCase
|
|
6
6
|
# -- fixture ------------------------------
|
7
7
|
|
8
8
|
module M
|
9
|
-
include Paramix
|
9
|
+
include Paramix::Parametric
|
10
|
+
|
11
|
+
parameterized do |params|
|
12
|
+
|
13
|
+
public :f do
|
14
|
+
params[:p]
|
15
|
+
end
|
10
16
|
|
11
|
-
def f
|
12
|
-
mixin_param(M,:p)
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
@@ -6,10 +6,14 @@ class TC_Paramix_Include < Test::Unit::TestCase
|
|
6
6
|
# -- fixture ------------------------------
|
7
7
|
|
8
8
|
module M
|
9
|
-
include Paramix
|
9
|
+
include Paramix::Parametric
|
10
|
+
|
11
|
+
parameterized do |params|
|
12
|
+
|
13
|
+
public :f do
|
14
|
+
params[:p]
|
15
|
+
end
|
10
16
|
|
11
|
-
def f
|
12
|
-
mixin_param(M,:p)
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
@@ -5,34 +5,34 @@ class TC_Paramix_Namespace < Test::Unit::TestCase
|
|
5
5
|
|
6
6
|
# -- fixture ------------------------------
|
7
7
|
|
8
|
-
module
|
8
|
+
module N
|
9
9
|
module M
|
10
|
-
include Paramix
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
include Paramix::Parametric
|
11
|
+
parameterized do |params|
|
12
|
+
public :f do
|
13
|
+
params[:p]
|
14
|
+
end
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
|
-
module
|
19
|
+
module Q
|
19
20
|
class I
|
20
|
-
include
|
21
|
+
include N::M[:p => "mosh"]
|
21
22
|
end
|
22
|
-
|
23
23
|
class E
|
24
|
-
extend
|
24
|
+
extend N::M[:p => "many"]
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
# -- tests --------------------------------
|
29
29
|
|
30
30
|
def test_class_1
|
31
|
-
assert_equal( "mosh",
|
31
|
+
assert_equal( "mosh", Q::I.new.f )
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_class_2
|
35
|
-
assert_equal( "many",
|
35
|
+
assert_equal( "many", Q::E.f )
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
metadata
CHANGED
@@ -3,10 +3,10 @@ name: paramix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
-
-
|
7
|
-
- 1
|
6
|
+
- 2
|
8
7
|
- 0
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 2.0.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Thomas Sawyer
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-06 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -44,15 +44,17 @@ files:
|
|
44
44
|
- meta/version
|
45
45
|
- test/nested/test_nested_both.rb
|
46
46
|
- test/nested/test_nested_bottom.rb
|
47
|
+
- test/nested/test_nested_moot.rb
|
48
|
+
- test/nested/test_nested_simple.rb
|
47
49
|
- test/nested/test_nested_top.rb
|
48
50
|
- test/test_paramix_callback.rb
|
49
51
|
- test/test_paramix_extend.rb
|
50
52
|
- test/test_paramix_include.rb
|
51
|
-
- test/test_paramix_inject.rb
|
52
53
|
- test/test_paramix_namespace.rb
|
54
|
+
- HISTORY.rdoc
|
53
55
|
- LICENSE
|
54
56
|
- README.rdoc
|
55
|
-
-
|
57
|
+
- Syckfile
|
56
58
|
has_rdoc: true
|
57
59
|
homepage: http://rubyworks.github.com/paramix
|
58
60
|
licenses: []
|
@@ -87,9 +89,10 @@ summary: Parametric Mixins
|
|
87
89
|
test_files:
|
88
90
|
- test/nested/test_nested_both.rb
|
89
91
|
- test/nested/test_nested_bottom.rb
|
92
|
+
- test/nested/test_nested_moot.rb
|
93
|
+
- test/nested/test_nested_simple.rb
|
90
94
|
- test/nested/test_nested_top.rb
|
91
95
|
- test/test_paramix_callback.rb
|
92
96
|
- test/test_paramix_extend.rb
|
93
97
|
- test/test_paramix_include.rb
|
94
|
-
- test/test_paramix_inject.rb
|
95
98
|
- test/test_paramix_namespace.rb
|