Modify new interactor's argument list to handle some cases #242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I'm using hanami for my new project, and I love it. Thank you for a cool framework.
I've noticed that new interactor interface (from 1.1) cannot handle some argument patterns.
I propose a solution to handle such cases.
case 1: no keyword arguments
In this case, the actual arguments passed to #call is
['foo', 'bar', {}]
This can be avoided to change #call args to
call(foo, bar, *)
but i think it is not cool 🤔case 2: no keyword arguments and an argument with
#to_hash
methodIn this case, the last argument is converted into Hash automatically if it implements
#to_hash
.Because
Hanami::Entity
implements#to_hash
, this case may happen often, and makes the behavior unexpected 😢