Skip to content
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

Do not dup class and module name constants #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matas-zanevicius
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant