Module: RCelery::Rails

Defined in:
lib/rcelery/rails.rb

Class Method Summary collapse

Class Method Details

.initializeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rcelery/rails.rb', line 9

def self.initialize
  config_file = File.join(::Rails.root, 'config', 'rcelery.yml')
  raw_config = nil

  if File.exists?(config_file)
    raw_config = YAML.load_file(config_file)[::Rails.env]
  end

  unless raw_config.nil?
    config = RCelery::Configuration.new(raw_config)
    if config.eager_mode
      RCelery.start(config)
    else
      Qusion.start(config.to_hash) do
        RCelery.start(config)
      end
    end
  end
end