Class: Hoth::ServiceRegistry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/hoth/service_registry.rb

Overview

The ServiceRegistry knows all registered services. You can register new services and locate existing services.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_service(service) ⇒ Object

add a service to the registry



10
11
12
# File 'lib/hoth/service_registry.rb', line 10

def self.add_service(service)
  instance.add_service(service)
end

.locate_service(service_name) ⇒ Object

find a service with a given name



16
17
18
# File 'lib/hoth/service_registry.rb', line 16

def self.locate_service(service_name)
  instance.locate_service(service_name)
end

Instance Method Details

#add_service(service) ⇒ Object

:nodoc:



20
21
22
# File 'lib/hoth/service_registry.rb', line 20

def add_service(service) # :nodoc:
  @registry[service.name.to_sym] = service
end

#locate_service(service_name) ⇒ Object

:nodoc:



24
25
26
# File 'lib/hoth/service_registry.rb', line 24

def locate_service(service_name) # :nodoc:
  @registry[service_name.to_sym]
end