New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middlewares #2
Middlewares #2
Conversation
Wow, I did not notice #1. If your opinion on this topic has not changed, I can make it a plugin system instead of what is present in this pull request. |
lib/polist/service.rb
Outdated
@@ -52,6 +71,7 @@ def initialize(params = {}) | |||
def call; end | |||
|
|||
def run | |||
call_middlewares |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way the middlewares are only going to be called if I do Example.run
and not if I do Example.call
. And the only difference between these 2 methods should be that the latter raises exception in case of failure.
I think that this feature is useful enough to be in core gem, but I see some problems with the implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
Good news that we already have callbacks implementation in https://github.com/umbrellio/verifly (Verifly::DependentCallbacks) around callback is same thing as middleware |
Pull Request Test Coverage Report for Build 24
💛 - Coveralls |
Pull Request Test Coverage Report for Build 25
💛 - Coveralls |
We can either wait for rubocop/rubocop#6711 to be released (and rubocop-config-umbrellio to be updated), or I can disable this cop manually for this gem. @tycooon |
Let’s just disable it for now. |
Consider having a common logic that has to be executed in many services inside an application. Let's say we have an authorization process:
Wouldn't it be better to have middlewares?
@tycooon what do you think?