rtype 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rtype/version.rb +1 -1
- data/lib/rtype.rb +9 -0
- data/spec/rtype_spec.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a159edd67900a539b8feea9186d429667af1a160
|
4
|
+
data.tar.gz: 7cb75c0716d949ffce2e312032d613051a57c138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f057cb5fb3bf0c21f6efecae853342f85617f823ef55060fb186bb74474c337fd741cdeeead59ac9fe81552d3c4d675fe9e2f19e9f9ad8292d24f15083b1d098
|
7
|
+
data.tar.gz: 47e53f18661b3817f18259caf52b158a65f2d3912ec89072ef166f452b8573e2da00e349beba64c41668047d9a0f6b9eba025dc67ffa32cf128e3b7b96941249
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ Test::invert(state: 0)
|
|
29
29
|
|
30
30
|
## Requirements
|
31
31
|
- Ruby >= 2.1
|
32
|
-
- If you need to use old ruby, see [rtype-legacy](https://github.com/sputnikgugja/rtype
|
32
|
+
- If you need to use old ruby, see [rtype-legacy](https://github.com/sputnikgugja/rtype-legacy) for ruby 1.9+
|
33
33
|
- MRI
|
34
34
|
- If C native extension is used. otherwise it is not required
|
35
35
|
- JRuby (JRuby 9000+)
|
data/lib/rtype/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Rtype
|
2
|
-
VERSION = "0.6.
|
2
|
+
VERSION = "0.6.6".freeze
|
3
3
|
# rtype java extension version. nil If the extension is not used
|
4
4
|
JAVA_EXT_VERSION = nil unless const_defined?(:JAVA_EXT_VERSION, false)
|
5
5
|
# rtype c extension version. nil If the extension is not used
|
data/lib/rtype.rb
CHANGED
@@ -405,6 +405,9 @@ private
|
|
405
405
|
# @param return_sig
|
406
406
|
# @return [void]
|
407
407
|
def define_typed_method_to_proxy(owner, method_name, expected_args, expected_kwargs, return_sig)
|
408
|
+
priv = owner.private_method_defined?(method_name)
|
409
|
+
prot = owner.protected_method_defined?(method_name)
|
410
|
+
|
408
411
|
if expected_kwargs.empty?
|
409
412
|
# `send` is faster than `method(...).call`
|
410
413
|
owner.send(:_rtype_proxy).send :define_method, method_name do |*args, &block|
|
@@ -422,6 +425,12 @@ private
|
|
422
425
|
result
|
423
426
|
end
|
424
427
|
end
|
428
|
+
|
429
|
+
if priv
|
430
|
+
owner.send(:_rtype_proxy).send(:private, method_name)
|
431
|
+
elsif prot
|
432
|
+
owner.send(:_rtype_proxy).send(:protected, method_name)
|
433
|
+
end
|
425
434
|
nil
|
426
435
|
end
|
427
436
|
|
data/spec/rtype_spec.rb
CHANGED
@@ -609,7 +609,7 @@ describe Rtype do
|
|
609
609
|
it 'is hash-type argument, not keyword argument' do
|
610
610
|
klass.send :rtype, :return_arg, [{a: String}, {}] => Any
|
611
611
|
expect {
|
612
|
-
instance.return_arg({a: 123}
|
612
|
+
instance.return_arg({a: 123})
|
613
613
|
}.to raise_error Rtype::ArgumentTypeError
|
614
614
|
end
|
615
615
|
end
|
@@ -744,9 +744,11 @@ describe Rtype do
|
|
744
744
|
|
745
745
|
describe 'method visibility works' do
|
746
746
|
it 'protected' do
|
747
|
+
klass.send :rtype, :protected_func, [] => Any
|
747
748
|
expect {instance.protected_func}.to raise_error NoMethodError
|
748
749
|
end
|
749
750
|
it 'private' do
|
751
|
+
klass.send :rtype, :private_func, [] => Any
|
750
752
|
expect {instance.private_func}.to raise_error NoMethodError
|
751
753
|
end
|
752
754
|
end
|
@@ -776,7 +778,7 @@ describe Rtype do
|
|
776
778
|
it 'raises error' do
|
777
779
|
klass.send :rtype, :return_arg, [{a: String}, {}] => Any
|
778
780
|
expect {
|
779
|
-
instance.return_arg({a: "str", b: "str"}
|
781
|
+
instance.return_arg({a: "str", b: "str"})
|
780
782
|
}.to raise_error Rtype::ArgumentTypeError
|
781
783
|
end
|
782
784
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtype
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sputnik Gugja
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|