Class: SmartCore::Container::DependencyWatcher Private
- Inherits:
-
Object
- Object
- SmartCore::Container::DependencyWatcher
- Defined in:
- lib/smart_core/container/dependency_watcher.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.
Defined Under Namespace
Classes: Observer
Instance Method Summary collapse
- #clear_listeners(entity_path = nil) ⇒ void private
- #initialize(container) ⇒ void constructor private
- #notify(entity_path) ⇒ void private
- #unwatch(observer) ⇒ Boolean private
- #watch(entity_path, &observer) ⇒ SmartCore::Container::DependencyWatcher::Observer private
Constructor Details
#initialize(container) ⇒ 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 19 |
# File 'lib/smart_core/container/dependency_watcher.rb', line 15 def initialize(container) @container = container @observers = Hash.new { |h, k| h[k] = [] } @lock = SmartCore::Engine::ReadWriteLock.new end |
Instance Method Details
#clear_listeners(entity_path = nil) ⇒ 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/dependency_watcher.rb', line 58 def clear_listeners(entity_path = nil) # TODO: support for pattern-based pathes @lock.write_sync { remove_listeners(entity_path) } end |
#notify(entity_path) ⇒ 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.
27 28 29 |
# File 'lib/smart_core/container/dependency_watcher.rb', line 27 def notify(entity_path) @lock.read_sync { notify_listeners(entity_path) } end |
#unwatch(observer) ⇒ 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.
48 49 50 |
# File 'lib/smart_core/container/dependency_watcher.rb', line 48 def unwatch(observer) @lock.write_sync { remove_listener(observer) } end |
#watch(entity_path, &observer) ⇒ SmartCore::Container::DependencyWatcher::Observer
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.
38 39 40 |
# File 'lib/smart_core/container/dependency_watcher.rb', line 38 def watch(entity_path, &observer) # TODO: support for pattern-based pathes @lock.write_sync { listen(entity_path, observer) } end |