Skip to content

Instantly share code, notes, and snippets.

@rx
Created September 8, 2021 12:20
Show Gist options
  • Save rx/c4877ed2af4488ed3e29b6b7ea877d74 to your computer and use it in GitHub Desktop.
Save rx/c4877ed2af4488ed3e29b6b7ea877d74 to your computer and use it in GitHub Desktop.
Service Dependency Injection
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