sorbet-coerce 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/private/converter.rb +4 -1
- data/lib/sorbet-coerce.rbi +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aa2115660631b882945bc26ce5ac623482cefcce7f7c54286111a1094340466
|
4
|
+
data.tar.gz: fd8d9ff4289975b73fc64cb342c32abfe859bc5cc8e1e81f9022b96112b5b028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5afed20eef79f73b1b2a0f0fa21a9619ddee55a64be7f7103b3f54ce2fe0d8148de702234f27884b0ab465644747328995f71b55a2a57b34bd690daf35b50fd5
|
7
|
+
data.tar.gz: b9bb17aa9c66f72c9ee3be9cf5eb6b33554e64d18675a64f592b2f64bab2354136582afc8abc594e1743873b7187174ad0d49c18c5065ee5fa52abe9445a2b98
|
data/lib/private/converter.rb
CHANGED
@@ -53,11 +53,14 @@ module T::Private
|
|
53
53
|
else
|
54
54
|
_convert(value, type.types[nil_idx == 0 ? 1 : 0])
|
55
55
|
end
|
56
|
+
elsif Object.const_defined?('T::Private::Types::TypeAlias') &&
|
57
|
+
type.is_a?(T::Private::Types::TypeAlias)
|
58
|
+
_convert(value, type.aliased_type)
|
56
59
|
elsif type < T::Struct
|
57
60
|
args = _build_args(value, type.props)
|
58
61
|
begin
|
59
62
|
type.new(args)
|
60
|
-
rescue
|
63
|
+
rescue
|
61
64
|
nil
|
62
65
|
end
|
63
66
|
else
|
data/lib/sorbet-coerce.rbi
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
# typed:
|
2
|
-
|
1
|
+
# typed: true
|
3
2
|
module T
|
4
3
|
module Coerce
|
5
4
|
extend T::Sig
|
@@ -10,4 +9,12 @@ module T
|
|
10
9
|
sig { params(args: T.untyped).returns(Elem) }
|
11
10
|
def from(args); end
|
12
11
|
end
|
12
|
+
|
13
|
+
module Private
|
14
|
+
module Types
|
15
|
+
class TypeAlias
|
16
|
+
def aliased_type; end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
13
20
|
end
|