Open matas-zanevicius opened 1 year ago
Say I want a service that calls another service. I can inject the class as a named argument.
class MyServiceA method_object [:other_service] def call other_service.call end end
But if I wanted to define a default service, I would end up with an anonymous class.
class MyServiceB def self.call # do stuff end end class MyServiceA method_object [other_service: MyServiceB] def call other_service.call end end
In many cases, it is not a big problem, but it does not make much sense to duplicate a class or a module either.
This PR is a possible solution.
Say I want a service that calls another service. I can inject the class as a named argument.
But if I wanted to define a default service, I would end up with an anonymous class.
In many cases, it is not a big problem, but it does not make much sense to duplicate a class or a module either.
This PR is a possible solution.