mangrove 0.30.1 → 0.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/mangrove/result.rb +28 -0
- data/lib/mangrove/version.rb +1 -1
- data/lib/tapioca/dsl/compilers/mangrove_enum.rb +7 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f834b6984567df445825c79b6027e0259d955c082aa68bbfbd7dc6ac1cf7e40
|
4
|
+
data.tar.gz: 989be7ac4cd2fab0ccf154785ab19560dd0133b51b76880d2e1ce281e638ea83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b4fe3703902f7f2c566f3789c3d2cc2e8ee4d02d2591bcedfa3425319af3da86d215c63ab6dfd5ba79826ff07f7f4ab4c33f8d33560eb2378a14a9a132e7030
|
7
|
+
data.tar.gz: fc2b7c8ad55cd4052b25837c64e20573b2ed0446871cb2f1c3a9d8dcd554224c44848256f0c2f9752161dfb54d7e6fcd5740d2a854aaff1117fa7e30fda80eeb
|
data/README.md
CHANGED
@@ -24,8 +24,8 @@ For more concrete examples, see [`spec/**/**_spec.rb`](https://github.com/kazzix
|
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
Mangrove::Result[OkType, ErrType]
|
27
|
-
Mangrove::Result::Ok[OkType
|
28
|
-
Mangrove::Result::Err[
|
27
|
+
Mangrove::Result::Ok[OkType]
|
28
|
+
Mangrove::Result::Err[ErrType]
|
29
29
|
Mangrove::Option[InnerType]
|
30
30
|
Mangrove::Option::Some[InnerType]
|
31
31
|
Mangrove::Option::None[InnerType]
|
data/lib/mangrove/result.rb
CHANGED
@@ -66,6 +66,12 @@ module Mangrove
|
|
66
66
|
sig { abstract.type_parameters(:NewErrType).params(_t_new_err: T::Class[T.type_parameter(:NewErrType)], block: T.proc.params(this: ErrType).returns(T.type_parameter(:NewErrType))).returns(Result[OkType, T.type_parameter(:NewErrType)]) }
|
67
67
|
def map_err_wt(_t_new_err, &block); end
|
68
68
|
|
69
|
+
sig { abstract.params(block: T.proc.params(this: OkType).void).returns(Result[OkType, ErrType]) }
|
70
|
+
def tap_ok(&block); end
|
71
|
+
|
72
|
+
sig { abstract.params(block: T.proc.params(this: ErrType).void).returns(Result[OkType, ErrType]) }
|
73
|
+
def tap_err(&block); end
|
74
|
+
|
69
75
|
sig { abstract.type_parameters(:NewOkType, :NewErrType).params(other: Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]).returns(T.any(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)], Result[T.type_parameter(:NewOkType), ErrType])) }
|
70
76
|
def and(other); end
|
71
77
|
|
@@ -256,6 +262,17 @@ module Mangrove
|
|
256
262
|
self
|
257
263
|
end
|
258
264
|
|
265
|
+
sig { override.params(block: T.proc.params(this: OkType).void).returns(Result[OkType, ErrType]) }
|
266
|
+
def tap_ok(&block)
|
267
|
+
block.call(@inner)
|
268
|
+
self
|
269
|
+
end
|
270
|
+
|
271
|
+
sig { override.params(_block: T.proc.params(this: ErrType).void).returns(Result[OkType, ErrType]) }
|
272
|
+
def tap_err(&_block)
|
273
|
+
self
|
274
|
+
end
|
275
|
+
|
259
276
|
sig { override.type_parameters(:NewOkType, :NewErrType).params(other: Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
|
260
277
|
def and(other)
|
261
278
|
other
|
@@ -429,6 +446,17 @@ module Mangrove
|
|
429
446
|
Result::Err[T.type_parameter(:NewErrType)].new(block.call(@inner))
|
430
447
|
end
|
431
448
|
|
449
|
+
sig { override.params(_block: T.proc.params(this: OkType).void).returns(Result[OkType, ErrType]) }
|
450
|
+
def tap_ok(&_block)
|
451
|
+
self
|
452
|
+
end
|
453
|
+
|
454
|
+
sig { override.params(block: T.proc.params(this: ErrType).void).returns(Result[OkType, ErrType]) }
|
455
|
+
def tap_err(&block)
|
456
|
+
block.call(@inner)
|
457
|
+
self
|
458
|
+
end
|
459
|
+
|
432
460
|
sig { override.type_parameters(:NewOkType, :NewErrType).params(_other: Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]).returns(Result[T.type_parameter(:NewOkType), ErrType]) }
|
433
461
|
def and(_other)
|
434
462
|
self
|
data/lib/mangrove/version.rb
CHANGED
@@ -48,7 +48,13 @@ module Tapioca
|
|
48
48
|
inner_type
|
49
49
|
}
|
50
50
|
|
51
|
-
|
51
|
+
return_type = if inner_types.size == 1
|
52
|
+
T.must(inner_types.first)
|
53
|
+
else
|
54
|
+
"T.any(#{inner_types.join(", ")})"
|
55
|
+
end
|
56
|
+
|
57
|
+
constant_type.create_method("inner", return_type:)
|
52
58
|
constant_type.create_method("as_super", return_type: constant.name.to_s)
|
53
59
|
constant_type.sort_nodes!
|
54
60
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangrove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuma Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.5.
|
135
|
+
rubygems_version: 3.5.22
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Toolkit for leveraging Sorbet's type system.
|