mangrove 0.19.2 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mangrove/result.rb +17 -4
- data/lib/mangrove/version.rb +1 -1
- 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: 761b124e30c530cd26a779e7e789633a3e84ed545f639e6655dcfd637b132da0
|
4
|
+
data.tar.gz: 2b65549240b5f94a9d52714620c8664d734cf2a065e5e165e666b45ed56064c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ae0b59477a9855dce2947f97556b871a111f631bc931d07cfa6f1be9630532d73c4bd3e7c4d883ac5bc75a52cfdd588eb5e83c63f8be0bbece59c1ad8c35b27
|
7
|
+
data.tar.gz: fd0ace87a61d26da101a4b1ae13521c67922e0aed43f1c658c570b991e5e5226fa4fac87f8b3d92045322bc82ceb60340013d1fd61180c796dfff7c0a8f98ba9
|
data/lib/mangrove/result.rb
CHANGED
@@ -30,6 +30,9 @@ module Mangrove
|
|
30
30
|
sig { abstract.returns(OkType) }
|
31
31
|
def unwrap!; end
|
32
32
|
|
33
|
+
sig { abstract.params(block: T.proc.params(err: ErrType).returns(Exception)).returns(OkType) }
|
34
|
+
def unwrap_or_raise_with!(&block); end
|
35
|
+
|
33
36
|
sig { abstract.params(exception: Exception).returns(OkType) }
|
34
37
|
def unwrap_or_raise!(exception); end
|
35
38
|
|
@@ -39,7 +42,7 @@ module Mangrove
|
|
39
42
|
sig { abstract.params(message: String).returns(OkType) }
|
40
43
|
def expect!(message); end
|
41
44
|
|
42
|
-
sig { abstract.type_parameters(:E).params(block: T.proc.returns(T.type_parameter(:E))).returns(OkType) }
|
45
|
+
sig { abstract.type_parameters(:E).params(block: T.proc.params(err: ErrType).returns(T.type_parameter(:E))).returns(OkType) }
|
43
46
|
def expect_with!(&block); end
|
44
47
|
|
45
48
|
sig { abstract.type_parameters(:NewOkType, :NewErrType).params(block: T.proc.params(this: Result[OkType, ErrType]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)])).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
|
@@ -186,6 +189,11 @@ module Mangrove
|
|
186
189
|
@inner
|
187
190
|
end
|
188
191
|
|
192
|
+
sig { override.params(block: T.proc.params(err: ErrType).returns(Exception)).returns(OkType) }
|
193
|
+
def unwrap_or_raise_with!(&block)
|
194
|
+
@inner
|
195
|
+
end
|
196
|
+
|
189
197
|
sig { override.returns(OkType) }
|
190
198
|
def unwrap_or_raise_inner!
|
191
199
|
@inner
|
@@ -196,7 +204,7 @@ module Mangrove
|
|
196
204
|
@inner
|
197
205
|
end
|
198
206
|
|
199
|
-
sig { override.type_parameters(:E).params(_block: T.proc.returns(T.type_parameter(:E))).returns(OkType) }
|
207
|
+
sig { override.type_parameters(:E).params(_block: T.proc.params(err: ErrType).returns(T.type_parameter(:E))).returns(OkType) }
|
200
208
|
def expect_with!(&_block)
|
201
209
|
@inner
|
202
210
|
end
|
@@ -350,6 +358,11 @@ module Mangrove
|
|
350
358
|
raise exception
|
351
359
|
end
|
352
360
|
|
361
|
+
sig { override.params(block: T.proc.params(err: ErrType).returns(Exception)).returns(OkType) }
|
362
|
+
def unwrap_or_raise_with!(&block)
|
363
|
+
raise block.call(@inner)
|
364
|
+
end
|
365
|
+
|
353
366
|
sig { override.returns(OkType) }
|
354
367
|
def unwrap_or_raise_inner!
|
355
368
|
raise T.unsafe(@inner)
|
@@ -360,9 +373,9 @@ module Mangrove
|
|
360
373
|
raise Result::ControlSignal, message
|
361
374
|
end
|
362
375
|
|
363
|
-
sig { override.type_parameters(:E).params(block: T.proc.returns(T.type_parameter(:E))).returns(OkType) }
|
376
|
+
sig { override.type_parameters(:E).params(block: T.proc.params(err: ErrType).returns(T.type_parameter(:E))).returns(OkType) }
|
364
377
|
def expect_with!(&block)
|
365
|
-
raise Result::ControlSignal, block.call
|
378
|
+
raise Result::ControlSignal, block.call(@inner)
|
366
379
|
end
|
367
380
|
|
368
381
|
sig { override.returns(T::Boolean) }
|
data/lib/mangrove/version.rb
CHANGED