Class: RabbitHutch::Configurator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Configurator

Returns a new instance of Configurator.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/configurator.rb', line 8

def initialize options
  
  file = options['config'] || (File.dirname(__FILE__) + '/../config.yaml')
  
  puts "Using config from #{file}"
  
  unless File.exists? file
    raise "Configuration file [#{file}] doesn't exist"
  end
  @config = YAML::load(File.open(file))
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



6
7
8
# File 'lib/configurator.rb', line 6

def config
  @config
end

Instance Method Details

#applicationObject



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

def application
  @config['application']
end

#consumersObject



28
29
30
# File 'lib/configurator.rb', line 28

def consumers
  @config['consumers_config']["consumers"]
end

#log_configObject



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

def log_config
  @config['log4r_config']
end

#rabbitmq_hostsObject



32
33
34
# File 'lib/configurator.rb', line 32

def rabbitmq_hosts
  @config['rabbitmq']['hosts']
end