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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -15
  3. data/README.md +326 -67
  4. data/Rakefile +8 -2
  5. data/lib/bcdd/result/callable_and_then/caller.rb +49 -0
  6. data/lib/bcdd/result/callable_and_then/config.rb +15 -0
  7. data/lib/bcdd/result/callable_and_then/error.rb +11 -0
  8. data/lib/bcdd/result/callable_and_then.rb +9 -0
  9. data/lib/bcdd/result/config/switchers/addons.rb +9 -4
  10. data/lib/bcdd/result/config/switchers/features.rb +5 -1
  11. data/lib/bcdd/result/config.rb +9 -3
  12. data/lib/bcdd/result/context/callable_and_then.rb +39 -0
  13. data/lib/bcdd/result/context/expectations/mixin.rb +11 -3
  14. data/lib/bcdd/result/context/mixin.rb +13 -5
  15. data/lib/bcdd/result/context/success.rb +12 -8
  16. data/lib/bcdd/result/context.rb +34 -16
  17. data/lib/bcdd/result/error.rb +20 -11
  18. data/lib/bcdd/result/expectations/mixin.rb +12 -6
  19. data/lib/bcdd/result/expectations.rb +7 -7
  20. data/lib/bcdd/result/mixin.rb +11 -5
  21. data/lib/bcdd/result/transitions/tracking/disabled.rb +14 -4
  22. data/lib/bcdd/result/transitions/tracking/enabled.rb +38 -18
  23. data/lib/bcdd/result/transitions/tree.rb +10 -6
  24. data/lib/bcdd/result/transitions.rb +8 -10
  25. data/lib/bcdd/result/version.rb +1 -1
  26. data/lib/bcdd/result.rb +38 -23
  27. data/sig/bcdd/result/callable_and_then.rbs +60 -0
  28. data/sig/bcdd/result/config.rbs +3 -0
  29. data/sig/bcdd/result/context.rbs +73 -9
  30. data/sig/bcdd/result/error.rbs +9 -6
  31. data/sig/bcdd/result/expectations.rbs +12 -8
  32. data/sig/bcdd/result/mixin.rbs +10 -2
  33. data/sig/bcdd/result/transitions.rbs +16 -5
  34. data/sig/bcdd/result.rbs +12 -8
  35. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bf2a03ac7efd3e75e03b2f5617518cb07f40e03cc970c612f3d4dfcdad153ad
4
- data.tar.gz: 2717e6e600101401f420164aed020689e9c07dd7f7296c78ec5290562620ca3c
3
+ metadata.gz: 677f88c68eb0f745246a910bbf4a659103a5695f3c5bd74f6ac6f0ba9ff3729f
4
+ data.tar.gz: 2966e659671b84bed72b2fb7ab4daaa19a1572a5480af3c19ab2a41b720d1265
5
5
  SHA512:
6
- metadata.gz: c1761571f7d0c0a6fd4601a9f8a4c8c18688085226cd061057f95c93737da80ac58e0a99a3803a0e0f93aa5040530975d9b16a7b54df79487ca625fd67d405d6
7
- data.tar.gz: 4b22f37d2282de4c0a6e3781e86c9c63457efa83a7d5dc07db4288b9fe19c5b3868cd13a34a1cfc515776cf466e2095bde9d10503f87b8f546ceab9408ef9617
6
+ metadata.gz: ee78777c66384e185ff7c1c816ea9fa2787ab14cde530a2fb2a9ec943755b86846a0a03cbc2742c2530cf9487380e9d23ce47663de366483d77af4bfe1fa3c8c
7
+ data.tar.gz: 7396cf7283c4d22dd7b03be855cf6f3a8e9c15ebbf8ef5194c34de762b99e9d6a41345066f7990be5a0e47e50da4bf38811191eb06916803881a12fab7a854b1
data/CHANGELOG.md CHANGED
@@ -1,38 +1,83 @@
1
1
  - [\[Unreleased\]](#unreleased)
2
- - [\[0.10.0\] - 2023-12-31](#0100---2023-12-31)
2
+ - [\[0.12.0\] - 2024-01-07](#0120---2024-01-07)
3
3
  - [Added](#added)
4
- - [\[0.9.1\] - 2023-12-12](#091---2023-12-12)
5
4
  - [Changed](#changed)
6
- - [Fixed](#fixed)
7
- - [\[0.9.0\] - 2023-12-12](#090---2023-12-12)
5
+ - [\[0.11.0\] - 2024-01-02](#0110---2024-01-02)
8
6
  - [Added](#added-1)
9
7
  - [Changed](#changed-1)
10
- - [\[0.8.0\] - 2023-12-11](#080---2023-12-11)
8
+ - [\[0.10.0\] - 2023-12-31](#0100---2023-12-31)
11
9
  - [Added](#added-2)
10
+ - [\[0.9.1\] - 2023-12-12](#091---2023-12-12)
12
11
  - [Changed](#changed-2)
13
- - [Removed](#removed)
14
- - [\[0.7.0\] - 2023-10-27](#070---2023-10-27)
12
+ - [Fixed](#fixed)
13
+ - [\[0.9.0\] - 2023-12-12](#090---2023-12-12)
15
14
  - [Added](#added-3)
16
15
  - [Changed](#changed-3)
17
- - [\[0.6.0\] - 2023-10-11](#060---2023-10-11)
16
+ - [\[0.8.0\] - 2023-12-11](#080---2023-12-11)
18
17
  - [Added](#added-4)
19
18
  - [Changed](#changed-4)
20
- - [\[0.5.0\] - 2023-10-09](#050---2023-10-09)
19
+ - [Removed](#removed)
20
+ - [\[0.7.0\] - 2023-10-27](#070---2023-10-27)
21
21
  - [Added](#added-5)
22
- - [\[0.4.0\] - 2023-09-28](#040---2023-09-28)
23
- - [Added](#added-6)
24
22
  - [Changed](#changed-5)
23
+ - [\[0.6.0\] - 2023-10-11](#060---2023-10-11)
24
+ - [Added](#added-6)
25
+ - [Changed](#changed-6)
26
+ - [\[0.5.0\] - 2023-10-09](#050---2023-10-09)
27
+ - [Added](#added-7)
28
+ - [\[0.4.0\] - 2023-09-28](#040---2023-09-28)
29
+ - [Added](#added-8)
30
+ - [Changed](#changed-7)
25
31
  - [Removed](#removed-1)
26
32
  - [\[0.3.0\] - 2023-09-26](#030---2023-09-26)
27
- - [Added](#added-7)
33
+ - [Added](#added-9)
28
34
  - [\[0.2.0\] - 2023-09-26](#020---2023-09-26)
29
- - [Added](#added-8)
35
+ - [Added](#added-10)
30
36
  - [Removed](#removed-2)
31
37
  - [\[0.1.0\] - 2023-09-25](#010---2023-09-25)
32
- - [Added](#added-9)
38
+ - [Added](#added-11)
33
39
 
34
40
  ## [Unreleased]
35
41
 
42
+ ## [0.12.0] - 2024-01-07
43
+
44
+ ### Added
45
+
46
+ - Add `BCDD::Result#and_then!` and `BCDD::Result::Context#and_then!` to execute a callable object (any object that responds to `#call`) to produce a result. The main difference between the `#and_then` and `#and_then!` is that the latter does not check the result source.
47
+ - **Attention:** to ensure the correct behavior, do not mix `#and_then` and `#and_then!` in the same result chain.
48
+ - This feature is turned off by default. You can enable it through the `BCDD::Result.config.feature.enable!(:and_then!)`.
49
+ - The method called by default (`:call`) can be changed through `BCDD::Result.config.and_then!.default_method_name_to_call=`.
50
+
51
+ ### Changed
52
+
53
+ - **(BREAKING)** Renames the subject concept/term to `source`. When a mixin is included/extended, it defines the `Success()` and `Failure()` methods. Since the results are generated in a context (instance or singleton where the mixin was used), they will have a defined source (instance or singleton itself).
54
+ > Definition of source
55
+ >
56
+ > From dictionary:
57
+ > * a place, person, or thing from which something comes or can be obtained.
58
+
59
+ ## [0.11.0] - 2024-01-02
60
+
61
+ ### Added
62
+
63
+ - Add the `Given()` addon to produce a `Success(:given, value)` result. As the `Continue()` addon, it is ignored by the expectations. Use it to add a value to the result chain and invoke the next step (through `and_then`).
64
+
65
+ ### Changed
66
+
67
+ - **(BREAKING)** Rename halted concept to terminal. Failures are terminal by default, but you can make a success terminal by enabling the `:continue` addon.
68
+ > Definition of terminal
69
+ >
70
+ > From dictionary:
71
+ > * of, forming, or situated at the end or extremity of something.
72
+ > * the end of a railroad or other transport route, or a station at such a point.
73
+ >
74
+ > From Wikipedia:
75
+ > * A "terminus" or "terminal" is a station at the end of a railway line.
76
+
77
+ - **(BREAKING)** Rename `BCDD::Result::Context::Success#and_expose` halted keyword argument to `terminal`.
78
+
79
+ - **(BREAKING)** Rename `BCDD::Result#halted?` to `BCDD::Result#terminal?`.
80
+
36
81
  ## [0.10.0] - 2023-12-31
37
82
 
38
83
  ### Added
@@ -45,7 +90,7 @@
45
90
 
46
91
  ### Changed
47
92
 
48
- - **(BREAKING)** Make `BCDD::Result::Context::Success#and_expose()` to produce a halted success by default. You can turn this off by passing `halted: false`.
93
+ - **(BREAKING)** Make `BCDD::Result::Context::Success#and_expose()` to produce a terminal success by default. You can turn this off by passing `halted: false`.
49
94
 
50
95
  ### Fixed
51
96