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

Change the behavior for Flows::Plugin::DependencyInjector #24

Open
ddemirkhanyan-vineti opened this issue Sep 23, 2020 · 0 comments
Open

Comments

@ddemirkhanyan-vineti
Copy link

ddemirkhanyan-vineti commented Sep 23, 2020

Currently the approach for defining the dependency is not very comfortable when defining a not required dependency.

  dependency :my_dependency,
             default: DefaultDependency,
             type: MyType,
             required: false | true

When the dependency is not required you have to pass a default otherwise it will error out, which proved to be non-optimal when dependencies are so not required there is even no default implementation.

The correct way to handle this seems to be the following:

  • When dependency is required - you have to pass it, if there is no default - it will error out
  • When the dependency is not required - if it's not passed and there is no default just evaluate the variable to nil

That way we can have it more flexible.

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

No branches or pull requests

1 participant