Class: Qyu::Factory::ServiceFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/qyu/factory.rb

Direct Known Subclasses

QueueFactory, StoreFactory

Class Method Summary collapse

Class Method Details

.get(config) ⇒ Object

Initialize Queue/Store service with provided configuration


26
27
28
29
# File 'lib/qyu/factory.rb', line 26

def get(config)
  Qyu.logger.info "Got factory #{types[config[:type]]}"
  types[config[:type]].new(config)
end

.register(adapter_class) ⇒ Class

Register a service (Queue/Store)


12
13
14
# File 'lib/qyu/factory.rb', line 12

def register(adapter_class)
  types[adapter_class::TYPE] = adapter_class
end

.typesHash

Get registered services


19
20
21
# File 'lib/qyu/factory.rb', line 19

def types
  @__types ||= {}
end