Module: SmartCore::Container::DependencyResolver Private
- Defined in:
- lib/smart_core/container/dependency_resolver.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Route
Constant Summary collapse
- PATH_PART_SEPARATOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'.'
Class Method Summary collapse
- .dependency?(container, dependency_path, memoized: nil) ⇒ Boolean private
- .fetch(container, dependency_path) ⇒ SmartCore::Container, Any private
- .key?(container, key) ⇒ Boolean private
- .namespace?(container, namespace_path) ⇒ Boolean private
- .resolve(container, dependency_path) ⇒ SmartCore::Container, Any private
Class Method Details
.dependency?(container, dependency_path, memoized: nil) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/smart_core/container/dependency_resolver.rb', line 62 def dependency?(container, dependency_path, memoized: nil) entity = extract(container, dependency_path) case when memoized == nil entity.is_a?(SmartCore::Container::Entities::Dependency) when !!memoized == true entity.is_a?(SmartCore::Container::Entities::MemoizedDependency) when !!memoized == false entity.is_a?(SmartCore::Container::Entities::Dependency) && !entity.is_a?(SmartCore::Container::Entities::MemoizedDependency) end rescue SmartCore::Container::ResolvingError false end |
.fetch(container, dependency_path) ⇒ SmartCore::Container, Any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/smart_core/container/dependency_resolver.rb', line 26 def fetch(container, dependency_path) container.registry.resolve(dependency_path).reveal(container) end |
.key?(container, key) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 40 41 |
# File 'lib/smart_core/container/dependency_resolver.rb', line 36 def key?(container, key) extract(container, key) true rescue SmartCore::Container::ResolvingError false end |
.namespace?(container, namespace_path) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 52 53 |
# File 'lib/smart_core/container/dependency_resolver.rb', line 49 def namespace?(container, namespace_path) extract(container, namespace_path).is_a?(SmartCore::Container::Entities::Namespace) rescue SmartCore::Container::ResolvingError false end |
.resolve(container, dependency_path) ⇒ SmartCore::Container, Any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/smart_core/container/dependency_resolver.rb', line 91 def resolve(container, dependency_path) entity = container host_container = container Route.build(dependency_path).each do |cursor| entity = entity.registry.resolve(cursor.current_path) prevent_ambiguous_resolving!(cursor, entity) entity = entity.reveal(host_container) host_container = entity.is_a?(SmartCore::Container) ? entity : nil end entity rescue SmartCore::Container::ResolvingError => error process_resolving_error(dependency_path, error) end |