bcdd-result 0.10.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -15
- data/README.md +326 -67
- data/Rakefile +8 -2
- data/lib/bcdd/result/callable_and_then/caller.rb +49 -0
- data/lib/bcdd/result/callable_and_then/config.rb +15 -0
- data/lib/bcdd/result/callable_and_then/error.rb +11 -0
- data/lib/bcdd/result/callable_and_then.rb +9 -0
- data/lib/bcdd/result/config/switchers/addons.rb +9 -4
- data/lib/bcdd/result/config/switchers/features.rb +5 -1
- data/lib/bcdd/result/config.rb +9 -3
- data/lib/bcdd/result/context/callable_and_then.rb +39 -0
- data/lib/bcdd/result/context/expectations/mixin.rb +11 -3
- data/lib/bcdd/result/context/mixin.rb +13 -5
- data/lib/bcdd/result/context/success.rb +12 -8
- data/lib/bcdd/result/context.rb +34 -16
- data/lib/bcdd/result/error.rb +20 -11
- data/lib/bcdd/result/expectations/mixin.rb +12 -6
- data/lib/bcdd/result/expectations.rb +7 -7
- data/lib/bcdd/result/mixin.rb +11 -5
- data/lib/bcdd/result/transitions/tracking/disabled.rb +14 -4
- data/lib/bcdd/result/transitions/tracking/enabled.rb +38 -18
- data/lib/bcdd/result/transitions/tree.rb +10 -6
- data/lib/bcdd/result/transitions.rb +8 -10
- data/lib/bcdd/result/version.rb +1 -1
- data/lib/bcdd/result.rb +38 -23
- data/sig/bcdd/result/callable_and_then.rbs +60 -0
- data/sig/bcdd/result/config.rbs +3 -0
- data/sig/bcdd/result/context.rbs +73 -9
- data/sig/bcdd/result/error.rbs +9 -6
- data/sig/bcdd/result/expectations.rbs +12 -8
- data/sig/bcdd/result/mixin.rbs +10 -2
- data/sig/bcdd/result/transitions.rbs +16 -5
- data/sig/bcdd/result.rbs +12 -8
- metadata +8 -2
data/sig/bcdd/result.rbs
CHANGED
@@ -4,25 +4,26 @@ class BCDD::Result
|
|
4
4
|
private attr_reader type_checker: BCDD::Result::Contract::TypeChecker
|
5
5
|
|
6
6
|
attr_reader data: BCDD::Result::Data
|
7
|
-
attr_reader
|
8
|
-
attr_reader
|
7
|
+
attr_reader source: untyped
|
8
|
+
attr_reader terminal: bool
|
9
9
|
attr_reader transitions: Hash[Symbol, untyped]
|
10
10
|
|
11
11
|
def self.config: -> BCDD::Result::Config
|
12
12
|
def self.configuration: { (BCDD::Result::Config) -> void } -> BCDD::Result::Config
|
13
|
+
def self.transitions: { () -> untyped } -> BCDD::Result
|
13
14
|
|
14
15
|
def initialize: (
|
15
16
|
type: Symbol,
|
16
17
|
value: untyped,
|
17
|
-
?
|
18
|
+
?source: untyped,
|
18
19
|
?expectations: BCDD::Result::Contract::Evaluator,
|
19
|
-
?
|
20
|
+
?terminal: bool
|
20
21
|
) -> void
|
21
22
|
|
22
23
|
def type: -> Symbol
|
23
24
|
def value: -> untyped
|
24
25
|
|
25
|
-
def
|
26
|
+
def terminal?: -> bool
|
26
27
|
def success?: (?Symbol type) -> bool
|
27
28
|
def failure?: (?Symbol type) -> bool
|
28
29
|
|
@@ -33,7 +34,9 @@ class BCDD::Result
|
|
33
34
|
def on_failure: (*Symbol) { (untyped, Symbol) -> void } -> BCDD::Result
|
34
35
|
def on_unknown: () { (untyped, Symbol) -> void } -> BCDD::Result
|
35
36
|
|
36
|
-
def and_then: (?Symbol method_name, ?untyped
|
37
|
+
def and_then: (?Symbol method_name, ?untyped injected_value) ?{ (untyped) -> untyped } -> untyped
|
38
|
+
|
39
|
+
def and_then!: (untyped, ?untyped injected_value, _call: (Symbol | nil)) -> untyped
|
37
40
|
|
38
41
|
def handle: () { (BCDD::Result::Handler) -> void } -> untyped
|
39
42
|
|
@@ -51,10 +54,11 @@ class BCDD::Result
|
|
51
54
|
|
52
55
|
def kind: -> Symbol
|
53
56
|
def known: (Proc) -> untyped
|
54
|
-
def
|
55
|
-
def
|
57
|
+
def call_and_then_source_method: (Symbol, untyped) -> BCDD::Result
|
58
|
+
def call_and_then_source_method!: (untyped, untyped) -> BCDD::Result
|
56
59
|
def call_and_then_block: (untyped) -> BCDD::Result
|
57
60
|
def call_and_then_block!: (untyped) -> BCDD::Result
|
61
|
+
def call_and_then_callable!: (untyped, value: untyped, injected_value: untyped, method_name: (Symbol | nil)) -> BCDD::Result
|
58
62
|
def ensure_result_object: (untyped, origin: Symbol) -> BCDD::Result
|
59
63
|
end
|
60
64
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcdd-result
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Serradura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Empower Ruby apps with pragmatic use of Result pattern (monad), Railway
|
14
14
|
Oriented Programming, and B/CDD.
|
@@ -28,6 +28,10 @@ files:
|
|
28
28
|
- Steepfile
|
29
29
|
- lib/bcdd-result.rb
|
30
30
|
- lib/bcdd/result.rb
|
31
|
+
- lib/bcdd/result/callable_and_then.rb
|
32
|
+
- lib/bcdd/result/callable_and_then/caller.rb
|
33
|
+
- lib/bcdd/result/callable_and_then/config.rb
|
34
|
+
- lib/bcdd/result/callable_and_then/error.rb
|
31
35
|
- lib/bcdd/result/config.rb
|
32
36
|
- lib/bcdd/result/config/options.rb
|
33
37
|
- lib/bcdd/result/config/switcher.rb
|
@@ -36,6 +40,7 @@ files:
|
|
36
40
|
- lib/bcdd/result/config/switchers/features.rb
|
37
41
|
- lib/bcdd/result/config/switchers/pattern_matching.rb
|
38
42
|
- lib/bcdd/result/context.rb
|
43
|
+
- lib/bcdd/result/context/callable_and_then.rb
|
39
44
|
- lib/bcdd/result/context/expectations.rb
|
40
45
|
- lib/bcdd/result/context/expectations/mixin.rb
|
41
46
|
- lib/bcdd/result/context/failure.rb
|
@@ -67,6 +72,7 @@ files:
|
|
67
72
|
- lib/bcdd/result/transitions/tree.rb
|
68
73
|
- lib/bcdd/result/version.rb
|
69
74
|
- sig/bcdd/result.rbs
|
75
|
+
- sig/bcdd/result/callable_and_then.rbs
|
70
76
|
- sig/bcdd/result/config.rbs
|
71
77
|
- sig/bcdd/result/context.rbs
|
72
78
|
- sig/bcdd/result/contract.rbs
|