Class: XwotDiscovery::XwotServiceProtocol::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/xwot_discovery/service_protocol.rb

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



7
8
9
# File 'lib/xwot_discovery/service_protocol.rb', line 7

def initialize
  @registry = {}
end

Instance Method Details

#add(message) ⇒ Object



11
12
13
14
15
16
# File 'lib/xwot_discovery/service_protocol.rb', line 11

def add(message)
  @registry[message.location] ||= {
    uri: message.location,
    message: message
  }
end

#remove(message) ⇒ Object



25
26
27
# File 'lib/xwot_discovery/service_protocol.rb', line 25

def remove(message)
  @registry.delete(message.location)
end

#update(message) ⇒ Object



18
19
20
21
22
23
# File 'lib/xwot_discovery/service_protocol.rb', line 18

def update(message)
  @registry[message.location] = {
    uri: message.location,
    message: message
  }
end