Skip to content

Add pattern matching support via deconstruct_keys for Result and Failure#329

Merged
afuno merged 3 commits into
mainfrom
feature/SRV-403/result
Jan 31, 2026
Merged

Add pattern matching support via deconstruct_keys for Result and Failure#329
afuno merged 3 commits into
mainfrom
feature/SRV-403/result

Conversation

@afuno
Copy link
Copy Markdown
Member

@afuno afuno commented Jan 31, 2026

No description provided.

- Introduced `deconstruct_keys` to `Servactory::Result` and `Servactory::Exceptions::Failure` for Ruby 3.2+ pattern matching support.
- Created two example services (`Example1` and `Example2`) under `Usual::DeconstructKeys` to demonstrate functionality.
- Added corresponding RSpec tests to validate and illustrate `deconstruct_keys` behavior, including key filtering, case/in matching, and nested error handling.
- Updated comments and RBS definitions to document `deconstruct_keys`.
@afuno afuno added this to the v3.0.0 milestone Jan 31, 2026
@afuno afuno self-assigned this Jan 31, 2026
@afuno afuno added the feature label Jan 31, 2026
@afuno afuno marked this pull request as ready for review January 31, 2026 12:44
- Added a new RSpec test to `Example2` service under `Usual::DeconstructKeys` to validate behavior when filtering specific keys (e.g., `[:type]`) via `Failure#deconstruct_keys`.
- Ensures accurate handling of key filtering in failure results, improving test coverage for pattern matching scenarios.
@afuno afuno changed the title Add deconstruct_keys support and examples for pattern matching Add pattern matching support via deconstruct_keys for Result and Failure Jan 31, 2026
- Simplified the doc comment in `Servactory::Result` to reflect general pattern matching support, removing the specific mention of Ruby 3.2+.
- Maintains clarity while ensuring the comment is less version-dependent.
@afuno afuno merged commit 62ffa04 into main Jan 31, 2026
37 checks passed
@afuno afuno deleted the feature/SRV-403/result branch January 31, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant