Class: SQSPoller::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/sqspoller/config.rb

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



21
22
23
# File 'lib/sqspoller/config.rb', line 21

def [](key)
  @config[key]
end

.load(file_list) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/sqspoller/config.rb', line 4

def load(file_list)
  @config = {}
  file_list.each do |cfg_file|
      cfg_file = File.expand_path(cfg_file)
      @config.merge!(YAML.load(File.read(cfg_file))) if File.exist?(cfg_file)
  end
  @config
end

.load_handlersObject



13
14
15
16
17
18
19
# File 'lib/sqspoller/config.rb', line 13

def load_handlers
  @config['sqspoller']['queues'].keys.each do |queue|
    (SQSPoller.warn("Queue '#{queue}' is not configured with a handler");next) if @config['sqspoller']['queues'][queue]['handlers'].nil?
    handlers = @config['sqspoller']['queues'][queue]['handlers'].keys
    handlers.each { |handler| require "sqspoller/handlers/#{handler.downcase}" }
  end
end