Created
September 8, 2021 12:20
-
-
Save rx/c4877ed2af4488ed3e29b6b7ea877d74 to your computer and use it in GitHub Desktop.
Service Dependency Injection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Services | |
class DoesSomething < BaseService | |
def initialize(:some_parameter, :another_parameter, | |
some_other_service: Services::SomeOtherService.new) | |
@some_parameter = some_parameter | |
@another_parameter = another_parameter | |
end | |
def call | |
result = some_other_service.call(other_service_param: another_parameter) | |
result.data # Do something with the results | |
success | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment