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.



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

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

Instance Method Details

#after_exit(worker_summary) ⇒ Object

Public: Perform the ‘after_exit` action from the config.



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

def after_exit(worker_summary)
  Resqued::Config::AfterExit.new(worker_summary: worker_summary).apply_all(@config_data)
end

#after_fork(worker) ⇒ Object

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



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

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.



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

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.



37
38
39
# File 'lib/resqued/config.rb', line 37

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