bcdd-result 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +24 -11
- data/CHANGELOG.md +28 -0
- data/README.md +585 -160
- data/lib/bcdd/result/context/expectations/mixin.rb +35 -0
- data/lib/bcdd/result/context/expectations.rb +41 -0
- data/lib/bcdd/result/context/failure.rb +9 -0
- data/lib/bcdd/result/context/mixin.rb +38 -0
- data/lib/bcdd/result/context/success.rb +15 -0
- data/lib/bcdd/result/context.rb +74 -0
- data/lib/bcdd/result/{expectations/contract → contract}/disabled.rb +2 -2
- data/lib/bcdd/result/{expectations → contract}/error.rb +5 -3
- data/lib/bcdd/result/{expectations/contract → contract}/evaluator.rb +2 -2
- data/lib/bcdd/result/{expectations/contract → contract}/for_types.rb +2 -2
- data/lib/bcdd/result/{expectations/contract → contract}/for_types_and_values.rb +10 -8
- data/lib/bcdd/result/contract/interface.rb +21 -0
- data/lib/bcdd/result/{expectations → contract}/type_checker.rb +1 -1
- data/lib/bcdd/result/contract.rb +43 -0
- data/lib/bcdd/result/error.rb +7 -9
- data/lib/bcdd/result/expectations/mixin.rb +14 -9
- data/lib/bcdd/result/expectations.rb +28 -37
- data/lib/bcdd/result/failure/methods.rb +21 -0
- data/lib/bcdd/result/failure.rb +2 -16
- data/lib/bcdd/result/mixin.rb +8 -3
- data/lib/bcdd/result/success/methods.rb +21 -0
- data/lib/bcdd/result/success.rb +2 -16
- data/lib/bcdd/result/version.rb +1 -1
- data/lib/bcdd/result.rb +6 -4
- data/sig/bcdd/result.rbs +227 -83
- metadata +18 -10
- data/lib/bcdd/result/expectations/contract/interface.rb +0 -21
- data/lib/bcdd/result/expectations/contract.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dda53cc516fcb8d18b2bd3c8431f2ca8d5d7363b6e58fd57d3fe3d1b49877e20
|
4
|
+
data.tar.gz: 367b97ba29f35dd2d6918817db38a2253929252c616aebcb47d7fc024888d258
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3618c5090981f4923977708944d94c257879fe57c06d1b2c922b7378c026e4d39c8ab13fdf64ad6277cfea4229d43d120b0d3ec3d7cb676676f0bf8d6714892d
|
7
|
+
data.tar.gz: 880a2f0ebcd8f7bb9ee32b2967c39011211e604981d43b59735fc912ec414635bc152ab13549ba64c87af987f66a7c334fae909cd860d3f36f6b092565b8cf24
|
data/.rubocop.yml
CHANGED
@@ -15,31 +15,41 @@ Layout/LineLength:
|
|
15
15
|
Layout/ExtraSpacing:
|
16
16
|
AllowBeforeTrailingComments: true
|
17
17
|
|
18
|
-
|
18
|
+
Layout/MultilineMethodCallIndentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Lint/UnderscorePrefixedVariableName:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/AccessModifierDeclarations:
|
19
25
|
Enabled: false
|
20
26
|
|
21
27
|
Style/CaseEquality:
|
22
|
-
|
23
|
-
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/ClassAndModuleChildren:
|
31
|
+
Enabled: false
|
24
32
|
|
25
33
|
Style/Lambda:
|
26
34
|
EnforcedStyle: literal
|
27
35
|
|
36
|
+
Style/ParallelAssignment:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/SingleLineMethods:
|
40
|
+
Enabled: false
|
41
|
+
|
28
42
|
Style/MapToSet:
|
29
|
-
|
30
|
-
- lib/bcdd/result/expectations/contract/for_types.rb
|
43
|
+
Enabled: false
|
31
44
|
|
32
45
|
Style/MixinGrouping:
|
33
46
|
Enabled: false
|
34
47
|
|
35
|
-
|
48
|
+
Naming/MethodName:
|
36
49
|
Enabled: false
|
37
50
|
|
38
|
-
Naming/
|
39
|
-
|
40
|
-
- lib/bcdd/result/mixin.rb
|
41
|
-
- lib/bcdd/result/expectations.rb
|
42
|
-
- lib/bcdd/result/expectations/mixin.rb
|
51
|
+
Naming/VariableName:
|
52
|
+
Enabled: false
|
43
53
|
|
44
54
|
Metrics/BlockLength:
|
45
55
|
Exclude:
|
@@ -52,3 +62,6 @@ Metrics/ClassLength:
|
|
52
62
|
|
53
63
|
Minitest/MultipleAssertions:
|
54
64
|
Enabled: false
|
65
|
+
|
66
|
+
Minitest/AssertEmptyLiteral:
|
67
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,33 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.7.0] - 2023-10-27
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Add `BCDD::Result::Context`. It is a `BCDD::Result`, meaning it has all the features of the `BCDD::Result`. The main difference is that it only accepts keyword arguments as a value, which applies to the `and_then`: The called methods must receive keyword arguments, and the dependency injection will be performed through keyword arguments.<br/><br/>
|
8
|
+
As the input/output are hashes, the results of each `and_then` call will automatically accumulate. This is useful in operations chaining, as the result of the previous operations will be automatically available for the next one. Because of this behavior, the `BCDD::Result::Context` has the `#and_expose` method to expose only the desired keys from the accumulated result.
|
9
|
+
|
10
|
+
- Add `BCDD::Result::Context::Expectations.new` and `BCDD::Result::Context::Expectations.mixin`. Both are similar to `BCDD::Result::Expectations.new` and `BCDD::Result::Expectations.mixin`, but they are for `BCDD::Result::Context` instead of `BCDD::Result`.
|
11
|
+
- The `BCDD::Result::Context.mixin` and `BCDD::Result::Context::Expectations.mixin` support the `with: :Continue` option.
|
12
|
+
|
13
|
+
- Enhance Pattern Matching support. When a `NoMatchingPatternError` occurs inside a value checking, the `BCDD::Result::Contract::Error::UnexpectedValue` message will include the value and the expected patterns.
|
14
|
+
|
15
|
+
- Add `BCDD::Result::Success::Methods` to be share common methods between `BCDD::Result::Success` and `BCDD::Result::Context::Success`.
|
16
|
+
|
17
|
+
- Add `BCDD::Result::Failure::Methods` to be share common methods between `BCDD::Failure::Success` and `BCDD::Result::Context::Failure`.
|
18
|
+
|
19
|
+
- Make all mixin generators produce a named module. The module name will be added to the target class/module (who included/extended a `BCDD::Result`/`BCDD::Result::Context` mixin module).
|
20
|
+
|
21
|
+
- Add `BCDD::Result::Contract.nil_as_valid_value_checking!`. Please use this method when using the one-line pattern-matching operators on the result's value expectations.
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- **(BREAKING)** Rename `BCDD::Result::WrongResultSubject` to `BCDD::Result::Error::InvalidResultSubject`.
|
26
|
+
- **(BREAKING)** Rename `BCDD::Result::WrongSubjectMethodArity` to `BCDD::Result::Error::InvalidSubjectMethodArity`.
|
27
|
+
- **(BREAKING)** Rename the constant produced by `BCDD::Result::Expectations.mixins` from `Expected` to `Result`.
|
28
|
+
- Extract the major part of the `BCDD::Result::Expectations` components/features to `BCDD::Result::Contract`.
|
29
|
+
- **(BREAKING)** `BCDD::Result::Expectations::Error` became `BCDD::Result::Contract::Error`. So, `BCDD::Result::Expectations::Error::UnexpectedType` and `BCDD::Result::Expectations::Error::UnexpectedValue` are now `BCDD::Result::Contract::Error::UnexpectedType` and `BCDD::Result::Contract::Error::UnexpectedValue`.
|
30
|
+
|
3
31
|
## [0.6.0] - 2023-10-11
|
4
32
|
|
5
33
|
### Added
|