-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Attempt to lazy-load component when container is asked for key?
#120
Conversation
@@ -641,17 +666,19 @@ def inherited(klass) | |||
private | |||
|
|||
# @api private | |||
def load_local_component(component, default_namespace_fallback = false) | |||
def load_local_component(component, default_namespace_fallback = false, &block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/AbcSize: Assignment Branch Condition size for load_local_component is too high. [22.8/20]
Metrics/PerceivedComplexity: Perceived complexity for load_local_component is too high. [8/7]
@@ -593,8 +618,8 @@ def require_path(path) | |||
end | |||
|
|||
# @api private | |||
def load_component(key) | |||
return self if key?(key) | |||
def load_component(key, &block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/PerceivedComplexity: Perceived complexity for load_component is too high. [8/7]
|
||
gemspec | ||
|
||
gem 'bootsnap' | ||
gem 'dry-monitor' | ||
gem 'dry-container', github: 'dry-container' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem dry-container should appear before dry-monitor.
I forgot to mention, it resolves #109 |
This also adds `Container.registered?` which acts as `key?` used to. Besides it, `Container.resove` not takes an optional block to make this interface constistent with dry-container
6d65469
to
fca4a64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @flash-gordon 👍
This also adds
Container.registered?
which acts askey?
used to.Besides it,
Container.resolve
not takes an optional block to make this interface consistent with dry-container.