Class: Resqued::Config::Configuration

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

Overview

Does the things that the config file says to do.

Instance Method Summary collapse

Constructor Details

#initialize(config_paths) ⇒ Configuration

Returns a new instance of Configuration.



16
17
18
# File 'lib/resqued/config.rb', line 16

def initialize(config_paths)
  @config_data = config_paths.map { |path| {:content => File.read(path), :path => path} }
end

Instance Method Details

#after_fork(worker) ⇒ Object

Public: Performs the ‘after_fork` action from the config.



26
27
28
# File 'lib/resqued/config.rb', line 26

def after_fork(worker)
  Resqued::Config::AfterFork.new(:worker => worker).apply_all(@config_data)
end

#before_fork(resqued) ⇒ Object

Public: Performs the ‘before_fork` action from the config.



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

def before_fork(resqued)
  Resqued::Config::BeforeFork.new(:resqued => resqued).apply_all(@config_data)
end

#build_workersObject

Public: Builds the workers specified in the config.



31
32
33
# File 'lib/resqued/config.rb', line 31

def build_workers
  Resqued::Config::Worker.new(:config => self).apply_all(@config_data)
end