Open bobbytables opened 7 years ago
This certainly isn't a direct solution to your feature request (and you posted this 3 years ago 🤷), but with the lack of communication from the project maintainers, I forked Interactor. I'm making some pretty significant changes, but specifically you might like the more strict concept of interactor attributes rather than having a special context: https://github.com/taylorthurlow/interaktor
I would love to see the ability to define custom Context classes as long as they implement the proper methods (Similar to ActiveModel linting).
Reason being is that OpenStruct leaves a lot of room for error, and have a proper domain object for context would alleviate a lot of that. For example, it would be really nice to be able to do:
Explanation of what this example is doing:
Interactor::BaseContext
would implement all of the necessary internals of a context, for examplefail!
androllback!
.But since it doesn't include
OpenStruct
, the only values that can be set areemail
andpassword
due to theattr_accessor
in the custom context class.I like this because it makes you think of your design more coherently and actually gives more options at the end of an interactor call. For example, errors: