rubiconmd / injectable

Opinionated and declarative Dependency Injection library for ruby.
https://rubygems.org/gems/injectable
MIT License
34 stars 5 forks source link

Raise exception if dependency is already callable #15

Closed iovis closed 4 years ago

iovis commented 4 years ago

The work done for #7 changed how we aliased #call by adding it to the singleton class of the instance instead of returning a lambda with the behavior (so it can accept blocks if needed).

This had some benefits, but also could introduce some unexpected behavior if the original class already responded to #call.

For instance, when using ActionCable.server (which acts as a singleton), it would shadow the #call used as a Rack server to listen to clients wanting to register a WebSocket.

This work ensures the developer doesn't introduce unexpected side effects when inverting third party library dependencies.

codeclimate[bot] commented 4 years ago

Code Climate has analyzed commit 4295b65e and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3

View more on Code Climate.