Class: Punchblock::Client::ComponentRegistry
- Inherits:
-
Object
- Object
- Punchblock::Client::ComponentRegistry
- Defined in:
- lib/punchblock/client/component_registry.rb
Instance Method Summary collapse
- #<<(component) ⇒ Object
- #find_by_id(component_id) ⇒ Object
-
#initialize ⇒ ComponentRegistry
constructor
A new instance of ComponentRegistry.
Constructor Details
#initialize ⇒ ComponentRegistry
Returns a new instance of ComponentRegistry.
4 5 6 7 |
# File 'lib/punchblock/client/component_registry.rb', line 4 def initialize @mutex = Mutex.new @components = Hash.new end |
Instance Method Details
#<<(component) ⇒ Object
9 10 11 12 13 |
# File 'lib/punchblock/client/component_registry.rb', line 9 def <<(component) @mutex.synchronize do @components[component.component_id] = component end end |
#find_by_id(component_id) ⇒ Object
15 16 17 18 19 |
# File 'lib/punchblock/client/component_registry.rb', line 15 def find_by_id(component_id) @mutex.synchronize do @components[component_id] end end |