sorbet-coerce 0.0.1 → 0.1.0
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 +3 -0
- data/lib/sorbet-coerce.rb +5 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b782e5a5b86602bca93180834ff7ed40f1fc4f05b112aeff37bc7a64963e9f3a
|
4
|
+
data.tar.gz: cae4b199fe1f9f504641101995a55b2e56e16f8260da8a0b2289f59544fc8af3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9523a1ce9514a8203377b133b1f56f56c23e241bc01f47018588d11d096a5e1ba87ccb6b4372faea3f6efcf4384478241f1da198739bd0972943b187dd9c00e
|
7
|
+
data.tar.gz: 694ac86c81038acac9b8289dd5ebda5934c1f0f42d0c4a8a4f4d83bd01a58af272c61e95dedf5ff42da0b2a2aba4e5c5a1562d21006c0b51532b5a59f2f76851
|
data/lib/private/converter.rb
CHANGED
data/lib/sorbet-coerce.rb
CHANGED
@@ -11,9 +11,11 @@ module T
|
|
11
11
|
define_method(:to_s) { "#{name}#[#{type.to_s}]" }
|
12
12
|
|
13
13
|
define_method(:from) do |args|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
begin
|
15
|
+
T.send('let', send('_convert', args, type), type)
|
16
|
+
rescue TypeError
|
17
|
+
raise CoercionError.new(args, type)
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorbet-coerce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chan Zuckerberg Initiative
|
@@ -130,5 +130,6 @@ rubyforge_project:
|
|
130
130
|
rubygems_version: 2.7.9
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
|
-
summary:
|
133
|
+
summary: A type coercion lib works with Sorbet's static type checker and type definitions;
|
134
|
+
raises an error if the coercion fails.
|
134
135
|
test_files: []
|