Class: SmartCore::Container::Entities::MemoizedDependency Private
- Inherits:
-
Dependency
- Object
- Base
- Dependency
- SmartCore::Container::Entities::MemoizedDependency
- Defined in:
- lib/smart_core/container/entities/memoized_dependency.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #initialize(dependency_name, dependency_definition) ⇒ void constructor private
- #reveal(host_container = SmartCore::Container::NO_HOST_CONTAINER) ⇒ Any private
Constructor Details
#initialize(dependency_name, dependency_definition) ⇒ void
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.
15 16 17 18 |
# File 'lib/smart_core/container/entities/memoized_dependency.rb', line 15 def initialize(dependency_name, dependency_definition) super(dependency_name, dependency_definition) @lock = SmartCore::Engine::ReadWriteLock.new end |
Instance Method Details
#reveal(host_container = SmartCore::Container::NO_HOST_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 29 30 31 32 33 34 |
# File 'lib/smart_core/container/entities/memoized_dependency.rb', line 26 def reveal(host_container = SmartCore::Container::NO_HOST_CONTAINER) @lock.read_sync do unless instance_variable_defined?(:@revealed_dependency) @revealed_dependency = dependency_definition.call else @revealed_dependency end end end |