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

Attempt to lazy-load component when container is asked for key? #120

Merged
merged 1 commit into from
Jul 9, 2019

Conversation

flash-gordon
Copy link
Member

@flash-gordon flash-gordon commented Jul 8, 2019

This also adds Container.registered? which acts as key? used to.
Besides it, Container.resolve not takes an optional block to make this interface consistent with dry-container.

@@ -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)
Copy link

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)
Copy link

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'
Copy link

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.

@flash-gordon
Copy link
Member Author

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
Copy link
Member

@timriley timriley left a 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 👍

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.

None yet

3 participants