Open bonflintstone opened 3 years ago
This is simply done by implementing deconstruct_keys in the context, and will enable one to use interactors like this:
deconstruct_keys
context = MyInteractor.() case context in success: true, result: { first:, second: } do_stuff(first, second) in failure: true, error_message: log_error(message: error_message) end
More about pattern matching: https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html
Obligatory gif:
This seems like a cool use case for Ruby 3 and I love that it's proven backwards compatible in the testing. 👍
This is simply done by implementing
deconstruct_keys
in the context, and will enable one to use interactors like this:More about pattern matching: https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html
Obligatory gif: