Class: Adhearsion::Rayo::Client::ComponentRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/rayo/client/component_registry.rb

Instance Method Summary collapse

Constructor Details

#initializeComponentRegistry


7
8
9
10
# File 'lib/adhearsion/rayo/client/component_registry.rb', line 7

def initialize
  @mutex = Mutex.new
  @components = Hash.new
end

Instance Method Details

#<<(component) ⇒ Object


12
13
14
15
16
# File 'lib/adhearsion/rayo/client/component_registry.rb', line 12

def <<(component)
  @mutex.synchronize do
    @components[component.source_uri] = component
  end
end

#delete(component) ⇒ Object


24
25
26
27
28
29
# File 'lib/adhearsion/rayo/client/component_registry.rb', line 24

def delete(component)
  @mutex.synchronize do
    uri = @components.key component
    @components.delete uri
  end
end

#find_by_uri(uri) ⇒ Object


18
19
20
21
22
# File 'lib/adhearsion/rayo/client/component_registry.rb', line 18

def find_by_uri(uri)
  @mutex.synchronize do
    @components[uri]
  end
end