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.
rubocop:disable Metrics/ClassLength
Instance Attribute Summary collapse
- #registry ⇒ Hash<Symbol,SmartCore::Container::Entity> readonly private
Instance Method Summary collapse
- #each(&block) ⇒ Enumerable private
- #freeze! ⇒ void private
- #frozen? ⇒ Boolean private
- #hash_tree(resolve_dependencies: false) ⇒ Hash<String|Symbol,SmartCore::Container::Entities::Base|Any> (also: #to_h, #to_hash) private
- #initialize ⇒ void constructor private
- #register_dependency(name, &dependency_definition) ⇒ void private
- #register_namespace(name, &dependencies_definition) ⇒ void private
- #resolve(entity_path) ⇒ SmartCore::Container::Entity 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.
20 21 22 23 |
# File 'lib/smart_core/container/registry.rb', line 20 def initialize @registry = {} @access_lock = SmartCore::Container::ArbitaryLock.new end |
Instance Attribute Details
#registry ⇒ Hash<Symbol,SmartCore::Container::Entity> (readonly)
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 |
# File 'lib/smart_core/container/registry.rb', line 14 def registry @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.
75 76 77 |
# File 'lib/smart_core/container/registry.rb', line 75 def each(&block) thread_safe { enumerate(&block) } 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.
58 59 60 |
# File 'lib/smart_core/container/registry.rb', line 58 def freeze! thread_safe { freeze_state } end |
#frozen? ⇒ 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.
66 67 68 |
# File 'lib/smart_core/container/registry.rb', line 66 def frozen? thread_safe { state_frozen? } end |
#hash_tree(resolve_dependencies: false) ⇒ Hash<String|Symbol,SmartCore::Container::Entities::Base|Any> Also known as: to_h, to_hash
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.
83 84 85 |
# File 'lib/smart_core/container/registry.rb', line 83 def hash_tree(resolve_dependencies: false) thread_safe { build_hash_tree(resolve_dependencies: resolve_dependencies) } end |
#register_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.
This method returns an undefined value.
40 41 42 |
# File 'lib/smart_core/container/registry.rb', line 40 def register_dependency(name, &dependency_definition) thread_safe { add_dependency(name, dependency_definition) } end |
#register_namespace(name, &dependencies_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.
This method returns an undefined value.
50 51 52 |
# File 'lib/smart_core/container/registry.rb', line 50 def register_namespace(name, &dependencies_definition) thread_safe { add_namespace(name, dependencies_definition) } end |
#resolve(entity_path) ⇒ SmartCore::Container::Entity
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.
30 31 32 |
# File 'lib/smart_core/container/registry.rb', line 30 def resolve(entity_path) thread_safe { fetch_entity(entity_path) } end |