Class: SmartCore::Container::Registry Private
- Inherits:
-
Object
- Object
- SmartCore::Container::Registry
- Includes:
- Enumerable
- Defined in:
- lib/smart_core/container/registry.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 Method Summary collapse
- #each(&block) ⇒ Enumerable private
- #freeze ⇒ void private
- #frozen? ⇒ void private
- #initialize ⇒ void constructor private
- #namespace(name, &dependency_definitions) ⇒ void private
- #register(name, **options, &dependency_definition) ⇒ void private
- #resolve(dependency_path) ⇒ SmartCore::Container::Namespace, SmartCore::Container::Dependnecy private
- #to_h ⇒ Hash<Symbol,Any> private
Constructor Details
#initialize ⇒ 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.
14 15 16 17 |
# File 'lib/smart_core/container/registry.rb', line 14 def initialize @access_lock = Mutex.new @registry = {} end |
Instance Method Details
#each(&block) ⇒ Enumerable
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.
86 87 88 |
# File 'lib/smart_core/container/registry.rb', line 86 def each(&block) thread_safe { block_given? ? registry.each_value(&block) : registry.each_value } end |
#freeze ⇒ 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.
This method returns an undefined value.
23 24 25 |
# File 'lib/smart_core/container/registry.rb', line 23 def freeze thread_safe { freeze_state } end |
#frozen? ⇒ 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.
This method returns an undefined value.
31 32 33 |
# File 'lib/smart_core/container/registry.rb', line 31 def frozen? thread_safe { state_frozen? } end |
#namespace(name, &dependency_definitions) ⇒ 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.
This method returns an undefined value.
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/smart_core/container/registry.rb', line 70 def namespace(name, &dependency_definitions) thread_safe do raise( SmartCore::Container::FrozenRegistryError, 'Can not modify frozen registry' ) if state_frozen? append_namespace(name, dependency_definitions) end end |
#register(name, **options, &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.
option list
This method returns an undefined value.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/smart_core/container/registry.rb', line 53 def register(name, **, &dependency_definition) thread_safe do raise( SmartCore::Container::FrozenRegistryError, 'Can not modify frozen registry' ) if state_frozen? append_dependency(name, dependency_definition, **) end end |
#resolve(dependency_path) ⇒ SmartCore::Container::Namespace, SmartCore::Container::Dependnecy
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.
40 41 42 |
# File 'lib/smart_core/container/registry.rb', line 40 def resolve(dependency_path) thread_safe { fetch_dependency(dependency_path) } end |
#to_h ⇒ Hash<Symbol,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.
94 95 96 |
# File 'lib/smart_core/container/registry.rb', line 94 def to_h # TODO: implement :) end |