|
| 1 | +- [\[Unreleased\]](#unreleased) |
| 2 | + - [Added](#added) |
| 3 | + - [Changed](#changed) |
| 4 | + - [Removed](#removed) |
| 5 | +- [\[0.7.0\] - 2023-10-27](#070---2023-10-27) |
| 6 | + - [Added](#added-1) |
| 7 | + - [Changed](#changed-1) |
| 8 | +- [\[0.6.0\] - 2023-10-11](#060---2023-10-11) |
| 9 | + - [Added](#added-2) |
| 10 | + - [Changed](#changed-2) |
| 11 | +- [\[0.5.0\] - 2023-10-09](#050---2023-10-09) |
| 12 | + - [Added](#added-3) |
| 13 | +- [\[0.4.0\] - 2023-09-28](#040---2023-09-28) |
| 14 | + - [Added](#added-4) |
| 15 | + - [Changed](#changed-3) |
| 16 | + - [Removed](#removed-1) |
| 17 | +- [\[0.3.0\] - 2023-09-26](#030---2023-09-26) |
| 18 | + - [Added](#added-5) |
| 19 | +- [\[0.2.0\] - 2023-09-26](#020---2023-09-26) |
| 20 | + - [Added](#added-6) |
| 21 | + - [Removed](#removed-2) |
| 22 | +- [\[0.1.0\] - 2023-09-25](#010---2023-09-25) |
| 23 | + - [Added](#added-7) |
| 24 | + |
1 | 25 | ## [Unreleased] |
2 | 26 |
|
| 27 | +### Added |
| 28 | + |
| 29 | +- Add `BCDD::Result.config` |
| 30 | + - **Feature** |
| 31 | + ```ruby |
| 32 | + BCDD::Result.config.feature.options |
| 33 | + BCDD::Result.config.feature.enabled?(:expectations) |
| 34 | + BCDD::Result.config.feature.enable!(:expectations) |
| 35 | + BCDD::Result.config.feature.disable!(:expectations) |
| 36 | + ``` |
| 37 | + - **Default Add-ons** |
| 38 | + ```ruby |
| 39 | + BCDD::Result.config.addon.options |
| 40 | + BCDD::Result.config.addon.enabled?(:continue) |
| 41 | + BCDD::Result.config.addon.enable!(:continue) |
| 42 | + BCDD::Result.config.addon.disable!(:continue) |
| 43 | + ``` |
| 44 | + - **Pattern matching** |
| 45 | + ```ruby |
| 46 | + BCDD::Result.config.pattern_matching.options |
| 47 | + BCDD::Result.config.pattern_matching.enabled?(:nil_as_valid_value_checking) |
| 48 | + BCDD::Result.config.pattern_matching.enable!(:nil_as_valid_value_checking) |
| 49 | + BCDD::Result.config.pattern_matching.disable!(:nil_as_valid_value_checking) |
| 50 | + ``` |
| 51 | + - **Constant Aliases** |
| 52 | + ```ruby |
| 53 | + BCDD::Result.config.constant_alias.options |
| 54 | + BCDD::Result.config.constant_alias.enabled?('Result') |
| 55 | + BCDD::Result.config.constant_alias.enable!('Result') |
| 56 | + BCDD::Result.config.constant_alias.disable!('Result') |
| 57 | + ``` |
| 58 | + |
| 59 | +- Add `BCDD::Result::configuration`. It freezes the configuration, disallowing methods that promote changes but allowing the query ones. You can use this feature to ensure integrity in your configuration. |
| 60 | + ```ruby |
| 61 | + BCDD::Result.configuration do |config| |
| 62 | + config.addon.enable!(:continue) |
| 63 | +
|
| 64 | + config.constant_alias.enable!('Result') |
| 65 | +
|
| 66 | + config.pattern_matching.disable!(:nil_as_valid_value_checking) |
| 67 | +
|
| 68 | + config.feature.disable!(:expectations) if ::Rails.env.production? |
| 69 | + end |
| 70 | +
|
| 71 | + BCDD::Result.config.addon.enabled?(:continue) # true |
| 72 | + BCDD::Result.config.constant_alias.enabled?('Result') # true |
| 73 | +
|
| 74 | + BCDD::Result.config.addon.disable!(:continue) # raises FrozenError |
| 75 | + BCDD::Result.config.constant_alias.disable!('Result') # raises FrozenError |
| 76 | + ``` |
| 77 | + |
| 78 | +- Allow the pattern matching feature to be turned on/off through the `BCDD::Result::Expectations.mixin`. Now, it can be used without enabling it for the whole project. |
| 79 | + ```ruby |
| 80 | + extend BCDD::Result::Expectations.mixin( |
| 81 | + config: { |
| 82 | + addon: { continue: false }, |
| 83 | + pattern_matching: { nil_as_valid_value_checking: true }, |
| 84 | + }, |
| 85 | + success: { |
| 86 | + numbers: ->(value) { value => [Numeric, Numeric] }, |
| 87 | + division_completed: Numeric |
| 88 | + }, |
| 89 | + failure: { |
| 90 | + invalid_arg: String, |
| 91 | + division_by_zero: String |
| 92 | + } |
| 93 | + ) |
| 94 | + ``` |
| 95 | + |
| 96 | +### Changed |
| 97 | + |
| 98 | +- **(BREAKING)** Replace `BCDD::Result::Contract.nil_as_valid_value_checking!` with `BCDD::Result::Config.pattern_matching.enable!(:nil_as_valid_value_checking)`. |
| 99 | + |
| 100 | +- **(BREAKING)** Replace `BCDD::Result::Contract.nil_as_valid_value_checking?` with `BCDD::Result::Config.pattern_matching.enabled?(:nil_as_valid_value_checking)`. |
| 101 | + |
| 102 | +- **(BREAKING)** Replace `mixin(with:)` with `mixin(config:)` keyword argument. |
| 103 | + |
| 104 | +- **(BREAKING)** Change the addons definition. |
| 105 | + - **From** |
| 106 | + ```ruby |
| 107 | + BCDD::Result.mixin(with: :Continue) |
| 108 | + BCDD::Result.mixin(with: [:Continue]) |
| 109 | + ``` |
| 110 | + - **To** |
| 111 | + ```ruby |
| 112 | + BCDD::Result.mixin(config: { addon: { continue: true } }) |
| 113 | + ``` |
| 114 | + - These examples are valid to all kinds of mixins (`BCDD::Result.mixin`, `BCDD::Result::Context.mixin`, `BCDD::Result::Expectations.mixin`, `BCDD::Result::Context::Expectations.mixin`) |
| 115 | + |
| 116 | +### Removed |
| 117 | + |
| 118 | +- **(BREAKING)** Remove the `lib/result` file. Now you can define `Result` as an alias for `BCDD::Result` using `BCDD::Result::Config.constant_alias.enable!('Result')`. |
| 119 | + |
3 | 120 | ## [0.7.0] - 2023-10-27 |
4 | 121 |
|
5 | 122 | ### Added |
|
0 commit comments