Class: XwotDiscovery::XwotServiceProtocol::Registry
- Inherits:
-
Object
- Object
- XwotDiscovery::XwotServiceProtocol::Registry
- Defined in:
- lib/xwot_discovery/service_protocol.rb
Instance Method Summary collapse
- #add(message) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #remove(message) ⇒ Object
- #update(message) ⇒ Object
Constructor Details
#initialize ⇒ Registry
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() @registry[.location] ||= { uri: .location, message: } end |
#remove(message) ⇒ Object
25 26 27 |
# File 'lib/xwot_discovery/service_protocol.rb', line 25 def remove() @registry.delete(.location) end |
#update(message) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/xwot_discovery/service_protocol.rb', line 18 def update() @registry[.location] = { uri: .location, message: } end |