rubype 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -2
- data/README.md +16 -10
- data/Rakefile +1 -12
- data/lib/rubype/version.rb +1 -1
- data/lib/rubype.rb +80 -49
- data/rubype.gemspec +3 -3
- data/test/test_rubype.rb +72 -62
- metadata +9 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d752aa79376b7981146f2f8b9f6ef94f8fc74b20
|
4
|
+
data.tar.gz: de61c2ff8105a604256f0d89c1e6c65285a94ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08e2f22b13c8138246daf7c94417b73be722c55310aee0e21d0a6799d8c36673ef5b598f3b73dd8b32cb9aa1f4a1d81afcb8e5065e44e6bda52d7af47cc7cec8
|
7
|
+
data.tar.gz: 5792a3bc311e89a8ca0b5b5333819ce335969bda6f2c35d4ce64054d818070a03693af4340ee9d2597c840da97c0c0699ccfb86960afdd383fc47574df22d00a
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
# Ruby + Type = Rubype
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rubype.svg)](http://badge.fury.io/rb/rubype) [![Build Status](https://travis-ci.org/gogotanaka/Rubype.svg?branch=develop)](https://travis-ci.org/gogotanaka/Rubype) [![Dependency Status](https://gemnasium.com/gogotanaka/Rubype.svg)](https://gemnasium.com/gogotanaka/Rubype) [![Code Climate](https://codeclimate.com/github/gogotanaka/Rubype/badges/gpa.svg)](https://codeclimate.com/github/gogotanaka/Rubype)
|
4
|
+
|
3
5
|
```rb
|
4
6
|
# Assert class of both args is Numeric and class of return is String
|
5
7
|
def sum(x, y)
|
6
8
|
(x + y).to_s
|
7
9
|
end
|
8
|
-
typesig sum
|
10
|
+
typesig :sum, [Numeric, Numeric] => String
|
9
11
|
|
10
12
|
# Assert first arg has method #to_i
|
11
13
|
def sum(x, y)
|
12
14
|
x.to_i + y
|
13
15
|
end
|
14
|
-
typesig sum
|
16
|
+
typesig :sum, [:to_i, Numeric] => Numeric
|
15
17
|
```
|
16
18
|
|
17
19
|
|
@@ -31,12 +33,12 @@ class MyClass
|
|
31
33
|
def sum(x, y)
|
32
34
|
x + y
|
33
35
|
end
|
34
|
-
typesig sum
|
36
|
+
typesig :sum, [Numeric, Numeric] => Numeric
|
35
37
|
|
36
38
|
def wrong_sum(x, y)
|
37
39
|
'string'
|
38
40
|
end
|
39
|
-
typesig wrong_sum
|
41
|
+
typesig :wrong_sum, [Numeric, Numeric] => Numeric
|
40
42
|
end
|
41
43
|
|
42
44
|
MyClass.new.sum(1, 2)
|
@@ -54,7 +56,7 @@ class MyClass
|
|
54
56
|
def sum(x, y)
|
55
57
|
x.to_i + y
|
56
58
|
end
|
57
|
-
typesig sum
|
59
|
+
typesig :sum, [:to_i, Numeric] => Numeric
|
58
60
|
end
|
59
61
|
|
60
62
|
MyClass.new.sum('1', 2)
|
@@ -69,7 +71,7 @@ class People
|
|
69
71
|
def marry(people)
|
70
72
|
# Your Ruby code as usual
|
71
73
|
end
|
72
|
-
typesig marry
|
74
|
+
typesig :marry, [People] => Any
|
73
75
|
end
|
74
76
|
|
75
77
|
People.new.marry(People.new)
|
@@ -88,7 +90,7 @@ class MyClass
|
|
88
90
|
def method_with_type(x, y)
|
89
91
|
x + y
|
90
92
|
end
|
91
|
-
typesig sum
|
93
|
+
typesig :sum, [Numeric, Numeric] => Numeric
|
92
94
|
|
93
95
|
def method_without_type(x, y)
|
94
96
|
'string'
|
@@ -103,12 +105,12 @@ class MyClass
|
|
103
105
|
def foo(any_obj)
|
104
106
|
1
|
105
107
|
end
|
106
|
-
typesig foo
|
108
|
+
typesig :foo, [Any] => Numeric
|
107
109
|
|
108
110
|
def sum(x, y)
|
109
111
|
x.to_i + y
|
110
112
|
end
|
111
|
-
typesig sum
|
113
|
+
typesig :sum, [:to_i, Numeric] => Numeric
|
112
114
|
end
|
113
115
|
|
114
116
|
# It's totally OK!!
|
@@ -142,7 +144,11 @@ Commit your changes (`git commit -am 'Add some feature'`)
|
|
142
144
|
|
143
145
|
$ bundle exec rake test
|
144
146
|
|
145
|
-
|
147
|
+
......
|
148
|
+
|
149
|
+
Finished in 0.010961s, 547.3953 runs/s, 5017.7903 assertions/s.
|
150
|
+
|
151
|
+
6 runs, 55 assertions, 0 failures, 0 errors, 0 skips
|
146
152
|
|
147
153
|
Push to the branch (`git push origin my-new-feature`)
|
148
154
|
|
data/Rakefile
CHANGED
@@ -5,15 +5,4 @@ Rake::TestTask.new(:test) do |t|
|
|
5
5
|
t.libs << "test"
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
Rake::ExtensionTask.new("rubype") do |ext|
|
11
|
-
ext.lib_dir = "lib/rubype"
|
12
|
-
end
|
13
|
-
|
14
|
-
task :compile_and_test do
|
15
|
-
Rake::Task['compile'].invoke
|
16
|
-
Rake::Task['test'].invoke
|
17
|
-
end
|
18
|
-
|
19
|
-
task default: :compile_and_test
|
8
|
+
task default: :test
|
data/lib/rubype/version.rb
CHANGED
data/lib/rubype.rb
CHANGED
@@ -6,73 +6,104 @@ FalseClass.send(:include, Boolean)
|
|
6
6
|
|
7
7
|
class Module
|
8
8
|
private
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# @return [Module]
|
10
|
+
def __rubype__
|
11
|
+
prepend (@__rubype__ = Module.new) unless @__rubype__
|
12
|
+
@__rubype__
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
# @param meth [Symbol]
|
16
|
+
# @param type_info_hash [Hash] { [ArgInfo_1, ArgInfo_2, ... ArgInfo_n] => RtnInfo }
|
17
|
+
# @return self
|
18
|
+
def typesig(meth, type_info_hash)
|
19
|
+
::Rubype.send(:define_typed_method, self, meth, type_info_hash, __rubype__)
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
18
23
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
rtn
|
24
|
+
class Method
|
25
|
+
def type_info
|
26
|
+
if methods_hash = Rubype.typed_method_info[owner]
|
27
|
+
methods_hash[name]
|
24
28
|
end
|
25
|
-
self
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
29
32
|
module Rubype
|
30
33
|
class ArgumentTypeError < ::TypeError; end
|
31
34
|
class ReturnTypeError < ::TypeError; end
|
35
|
+
@@typed_method_info = Hash.new({})
|
32
36
|
|
33
37
|
class << self
|
38
|
+
def typed_method_info
|
39
|
+
@@typed_method_info
|
40
|
+
end
|
41
|
+
|
34
42
|
private
|
43
|
+
# @param caller [Object]
|
44
|
+
# @param type_info_hash [Hash] { [ArgInfo_1, ArgInfo_2, ... ArgInfo_n] => RtnInfo }
|
45
|
+
# @param module [Module]
|
46
|
+
def define_typed_method(meth_caller, meth, type_info_hash, __rubype__)
|
47
|
+
arg_types, rtn_type = *strip_type_info(type_info_hash)
|
48
|
+
@@typed_method_info[meth_caller][meth] = {
|
49
|
+
arg_types => rtn_type
|
50
|
+
}
|
51
|
+
__rubype__.send(:define_method, meth) do |*args, &block|
|
52
|
+
::Rubype.send(:assert_arg_type, meth_caller, meth, args, arg_types)
|
53
|
+
rtn = super(*args, &block)
|
54
|
+
::Rubype.send(:assert_trn_type, meth_caller, meth, rtn, rtn_type)
|
55
|
+
rtn
|
56
|
+
end
|
57
|
+
end
|
35
58
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
59
|
+
# @param type_info_hash [Hash] { [ArgInfo_1, ArgInfo_2, ... ArgInfo_n] => RtnInfo }
|
60
|
+
# @return arg_types [Array<Class, Symbol>], rtn_type [Class, Symbol]
|
61
|
+
def strip_type_info(type_info_hash)
|
62
|
+
arg_types, rtn_type = type_info_hash.first
|
63
|
+
[arg_types, rtn_type]
|
64
|
+
end
|
65
|
+
|
66
|
+
# @param caller [Module]
|
67
|
+
# @param meth [Symbol]
|
68
|
+
# @param args [Array<Object>]
|
69
|
+
# @param type_infos [Array<Class, Symbol>]
|
70
|
+
def assert_arg_type(caller, meth, args, type_infos)
|
71
|
+
args.zip(type_infos).each.with_index(1) do |(arg, type_info), i|
|
72
|
+
case type_check(arg, type_info)
|
73
|
+
when :need_correct_class
|
74
|
+
raise ArgumentTypeError,
|
75
|
+
"Expected #{caller.class}##{meth}'s #{i}th argument to be #{type_info} but got #{arg.inspect} instead"
|
76
|
+
when :need_correct_method
|
77
|
+
raise ArgumentTypeError,
|
78
|
+
"Expected #{caller.class}##{meth}'s #{i}th argument to have method ##{type_info} but got #{arg.inspect} instead"
|
79
|
+
end
|
49
80
|
end
|
50
81
|
end
|
51
|
-
end
|
52
82
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
83
|
+
# @param caller [Module]
|
84
|
+
# @param rtn [Object]
|
85
|
+
# @param type_info [Class, Symbol]
|
86
|
+
def assert_trn_type(caller, meth, rtn, type_info)
|
87
|
+
case type_check(rtn, type_info)
|
88
|
+
when :need_correct_class
|
89
|
+
raise ReturnTypeError,
|
90
|
+
"Expected #{caller.class}##{meth} to return #{type_info} but got #{rtn.inspect} instead"
|
91
|
+
when :need_correct_method
|
92
|
+
raise ReturnTypeError,
|
93
|
+
"Expected #{caller.class}##{meth} to return object which has method ##{type_info} but got #{rtn.inspect} instead"
|
94
|
+
end
|
64
95
|
end
|
65
|
-
end
|
66
96
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
97
|
+
# @param obj [Object]
|
98
|
+
# @param type_info [Class, Symbol]
|
99
|
+
# @return [Symbol]
|
100
|
+
def type_check(obj, type_info)
|
101
|
+
case type_info
|
102
|
+
when Module
|
103
|
+
:need_correct_class unless (obj.is_a?(type_info) || type_info == Any)
|
104
|
+
when Symbol
|
105
|
+
:need_correct_method unless (obj.respond_to?(type_info))
|
106
|
+
end
|
75
107
|
end
|
76
|
-
end
|
77
108
|
end
|
78
109
|
end
|
data/rubype.gemspec
CHANGED
@@ -8,7 +8,6 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Rubype::VERSION
|
9
9
|
spec.authors = ["gogotanaka"]
|
10
10
|
spec.email = ["mail@tanakakazuki.com"]
|
11
|
-
spec.extensions = ["ext/rubype/extconf.rb"]
|
12
11
|
spec.summary = %q{Ruby with type.}
|
13
12
|
spec.description = %q{Ruby with type.}
|
14
13
|
spec.homepage = "http://gogotanaka.me/"
|
@@ -19,8 +18,9 @@ Gem::Specification.new do |spec|
|
|
19
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
19
|
spec.require_paths = ["lib"]
|
21
20
|
|
22
|
-
spec.
|
21
|
+
spec.required_ruby_version = ">= 2.0.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
24
|
spec.add_development_dependency "rake"
|
24
|
-
spec.add_development_dependency "rake-compiler"
|
25
25
|
spec.add_development_dependency "minitest"
|
26
26
|
end
|
data/test/test_rubype.rb
CHANGED
@@ -14,79 +14,89 @@ class TestRubype < MiniTest::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_correct_type_by_class
|
17
|
-
assert_correct_type [Numeric => Numeric
|
18
|
-
assert_correct_type [Numeric => Array
|
19
|
-
assert_correct_type [Numeric => String
|
20
|
-
assert_correct_type [Numeric => Hash
|
21
|
-
assert_correct_type [Numeric => Symbol
|
22
|
-
assert_correct_type [Numeric => Boolean
|
23
|
-
assert_correct_type [Numeric => Boolean
|
24
|
-
|
25
|
-
assert_correct_type [Boolean, Numeric => Numeric
|
26
|
-
assert_correct_type [Boolean, Array
|
27
|
-
assert_correct_type [Boolean, String
|
28
|
-
assert_correct_type [Boolean, Hash
|
29
|
-
assert_correct_type [Boolean, Symbol
|
17
|
+
assert_correct_type({ [Numeric] => Numeric }, [@numeric], @numeric)
|
18
|
+
assert_correct_type({ [Numeric] => Array }, [@numeric], @array )
|
19
|
+
assert_correct_type({ [Numeric] => String }, [@numeric], @string )
|
20
|
+
assert_correct_type({ [Numeric] => Hash }, [@numeric], @hash )
|
21
|
+
assert_correct_type({ [Numeric] => Symbol }, [@numeric], @symbol )
|
22
|
+
assert_correct_type({ [Numeric] => Boolean }, [@numeric], true )
|
23
|
+
assert_correct_type({ [Numeric] => Boolean }, [@numeric], false )
|
24
|
+
|
25
|
+
assert_correct_type({ [Boolean, Numeric] => Numeric }, [true, @numeric], @numeric)
|
26
|
+
assert_correct_type({ [Boolean, Array ] => Array }, [true, @array ], @array)
|
27
|
+
assert_correct_type({ [Boolean, String ] => String }, [true, @string ], @string)
|
28
|
+
assert_correct_type({ [Boolean, Hash ] => Hash }, [true, @hash ], @hash)
|
29
|
+
assert_correct_type({ [Boolean, Symbol ] => Symbol }, [true, @symbol ], @symbol)
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_correct_type_by_sym
|
33
|
-
assert_correct_type [Numeric => :to_i
|
34
|
-
assert_correct_type [Numeric => :to_i
|
35
|
-
|
36
|
-
assert_correct_type [Numeric => :to_s
|
37
|
-
assert_correct_type [Numeric => :to_s
|
38
|
-
assert_correct_type [Numeric => :to_s
|
39
|
-
assert_correct_type [Numeric => :to_s
|
40
|
-
assert_correct_type [Numeric => :to_s
|
33
|
+
assert_correct_type({ [Numeric] => :to_i }, [@numeric], @numeric)
|
34
|
+
assert_correct_type({ [Numeric] => :to_i }, [@numeric], @string)
|
35
|
+
|
36
|
+
assert_correct_type({ [Numeric] => :to_s }, [@numeric], @numeric)
|
37
|
+
assert_correct_type({ [Numeric] => :to_s }, [@numeric], @string)
|
38
|
+
assert_correct_type({ [Numeric] => :to_s }, [@numeric], @symbol)
|
39
|
+
assert_correct_type({ [Numeric] => :to_s }, [@numeric], @array)
|
40
|
+
assert_correct_type({ [Numeric] => :to_s }, [@numeric], @hash)
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_wrong_return_type
|
44
|
-
assert_wrong_rtn [Numeric => Numeric
|
45
|
-
assert_wrong_rtn [Numeric => Numeric
|
46
|
-
assert_wrong_rtn [Numeric => Numeric
|
47
|
-
assert_wrong_rtn [Numeric => Numeric
|
48
|
-
assert_wrong_rtn [Numeric => Numeric
|
49
|
-
|
50
|
-
assert_wrong_rtn [Numeric, Numeric => Numeric
|
51
|
-
assert_wrong_rtn [Numeric, Numeric => Numeric
|
52
|
-
assert_wrong_rtn [Numeric, Numeric => Numeric
|
53
|
-
assert_wrong_rtn [Numeric, Numeric => Numeric
|
54
|
-
assert_wrong_rtn [Numeric, Numeric => Numeric
|
55
|
-
|
56
|
-
assert_wrong_rtn [Numeric => :to_i
|
57
|
-
assert_wrong_rtn [Numeric => :to_i
|
58
|
-
assert_wrong_rtn [Numeric => :to_i
|
44
|
+
assert_wrong_rtn({ [Numeric] => Numeric }, [@numeric], @array)
|
45
|
+
assert_wrong_rtn({ [Numeric] => Numeric }, [@numeric], @string)
|
46
|
+
assert_wrong_rtn({ [Numeric] => Numeric }, [@numeric], @hash)
|
47
|
+
assert_wrong_rtn({ [Numeric] => Numeric }, [@numeric], @symbol)
|
48
|
+
assert_wrong_rtn({ [Numeric] => Numeric }, [@numeric], true)
|
49
|
+
|
50
|
+
assert_wrong_rtn({ [Numeric, Numeric] => Numeric }, [@numeric, @numeric], @array)
|
51
|
+
assert_wrong_rtn({ [Numeric, Numeric] => Numeric }, [@numeric, @numeric], @string)
|
52
|
+
assert_wrong_rtn({ [Numeric, Numeric] => Numeric }, [@numeric, @numeric], @hash)
|
53
|
+
assert_wrong_rtn({ [Numeric, Numeric] => Numeric }, [@numeric, @numeric], @symbol)
|
54
|
+
assert_wrong_rtn({ [Numeric, Numeric] => Numeric }, [@numeric, @numeric], true)
|
55
|
+
|
56
|
+
assert_wrong_rtn({ [Numeric] => :to_i }, [@numeric], @symbol)
|
57
|
+
assert_wrong_rtn({ [Numeric] => :to_i }, [@numeric], @array)
|
58
|
+
assert_wrong_rtn({ [Numeric] => :to_i }, [@numeric], @hash)
|
59
59
|
end
|
60
60
|
|
61
61
|
def test_wrong_args_type
|
62
|
-
assert_wrong_arg [Numeric => Numeric
|
63
|
-
assert_wrong_arg [Numeric => Numeric
|
64
|
-
assert_wrong_arg [Numeric => Numeric
|
65
|
-
assert_wrong_arg [Numeric => Numeric
|
66
|
-
assert_wrong_arg [Numeric => Numeric
|
67
|
-
|
68
|
-
assert_wrong_arg [Numeric, Numeric => Numeric
|
69
|
-
assert_wrong_arg [Numeric, Numeric => Numeric
|
70
|
-
assert_wrong_arg [Numeric, Numeric => Numeric
|
71
|
-
assert_wrong_arg [Numeric, Numeric => Numeric
|
72
|
-
assert_wrong_arg [Numeric, Numeric => Numeric
|
73
|
-
|
74
|
-
assert_wrong_arg [Numeric => :to_i
|
75
|
-
assert_wrong_arg [Numeric => :to_i
|
76
|
-
assert_wrong_arg [Numeric => :to_i
|
77
|
-
assert_wrong_arg [Numeric => :to_i
|
62
|
+
assert_wrong_arg({ [Numeric] => Numeric }, [@array ], @numeric)
|
63
|
+
assert_wrong_arg({ [Numeric] => Numeric }, [@string], @numeric)
|
64
|
+
assert_wrong_arg({ [Numeric] => Numeric }, [@hash ], @numeric)
|
65
|
+
assert_wrong_arg({ [Numeric] => Numeric }, [@symbol], @numeric)
|
66
|
+
assert_wrong_arg({ [Numeric] => Numeric }, [true ], @numeric)
|
67
|
+
|
68
|
+
assert_wrong_arg({ [Numeric, Numeric] => Numeric }, [@numeric, @array ], @numeric)
|
69
|
+
assert_wrong_arg({ [Numeric, Numeric] => Numeric }, [@numeric, @string], @numeric)
|
70
|
+
assert_wrong_arg({ [Numeric, Numeric] => Numeric }, [@numeric, @hash ], @numeric)
|
71
|
+
assert_wrong_arg({ [Numeric, Numeric] => Numeric }, [@numeric, @symbol], @numeric)
|
72
|
+
assert_wrong_arg({ [Numeric, Numeric] => Numeric }, [@numeric, true ], @numeric)
|
73
|
+
|
74
|
+
assert_wrong_arg({ [Numeric] => :to_i }, [@array ], @numeric)
|
75
|
+
assert_wrong_arg({ [Numeric] => :to_i }, [@hash ], @numeric)
|
76
|
+
assert_wrong_arg({ [Numeric] => :to_i }, [@symbol], @numeric)
|
77
|
+
assert_wrong_arg({ [Numeric] => :to_i }, [true ], @numeric)
|
78
78
|
end
|
79
79
|
|
80
80
|
def test_any
|
81
|
-
assert_correct_type [Any => Any
|
82
|
-
assert_correct_type [Any => Any
|
83
|
-
assert_correct_type [Any => Any
|
84
|
-
assert_correct_type [Any => Any
|
85
|
-
|
86
|
-
assert_correct_type [Any, Any => Any
|
87
|
-
assert_correct_type [Any, Any => Any
|
88
|
-
assert_correct_type [Any, Any => Any
|
89
|
-
assert_correct_type [Any, Any => Any
|
81
|
+
assert_correct_type({ [Any] => Any }, [@array ], @numeric)
|
82
|
+
assert_correct_type({ [Any] => Any }, [@string], @numeric)
|
83
|
+
assert_correct_type({ [Any] => Any }, [@hash ], @numeric)
|
84
|
+
assert_correct_type({ [Any] => Any }, [@symbol], @numeric)
|
85
|
+
|
86
|
+
assert_correct_type({ [Any, Any] => Any }, [@numeric, @array ], @numeric)
|
87
|
+
assert_correct_type({ [Any, Any] => Any }, [@numeric, @string], @numeric)
|
88
|
+
assert_correct_type({ [Any, Any] => Any }, [@numeric, @hash ], @numeric)
|
89
|
+
assert_correct_type({ [Any, Any] => Any }, [@numeric, @symbol], @numeric)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_type_info
|
93
|
+
klass = Class.new.class_eval <<-RUBY_CODE
|
94
|
+
def test_mth
|
95
|
+
end
|
96
|
+
typesig :test_mth, [Numeric, Numeric] => String
|
97
|
+
RUBY_CODE
|
98
|
+
|
99
|
+
assert_equal klass.new.method(:test_mth).type_info, { [Numeric, Numeric] => String }
|
90
100
|
end
|
91
101
|
|
92
102
|
private
|
@@ -111,7 +121,7 @@ class TestRubype < MiniTest::Unit::TestCase
|
|
111
121
|
def call(#{arg_literal(args.count)})
|
112
122
|
#{obj_literal(val)}
|
113
123
|
end
|
114
|
-
typesig call
|
124
|
+
typesig :call, #{obj_literal(type_list)}
|
115
125
|
RUBY_CODE
|
116
126
|
|
117
127
|
klass.new
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubype
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gogotanaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake-compiler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: minitest
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,8 +57,7 @@ email:
|
|
71
57
|
- mail@tanakakazuki.com
|
72
58
|
executables:
|
73
59
|
- rubype
|
74
|
-
extensions:
|
75
|
-
- ext/rubype/extconf.rb
|
60
|
+
extensions: []
|
76
61
|
extra_rdoc_files: []
|
77
62
|
files:
|
78
63
|
- ".gitignore"
|
@@ -102,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
87
|
requirements:
|
103
88
|
- - ">="
|
104
89
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
90
|
+
version: 2.0.0
|
106
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
92
|
requirements:
|
108
93
|
- - ">="
|
@@ -110,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
95
|
version: '0'
|
111
96
|
requirements: []
|
112
97
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.4.5
|
114
99
|
signing_key:
|
115
100
|
specification_version: 4
|
116
101
|
summary: Ruby with type.
|