Sha256: f45940e2865e76cdb438f6b578ed454922728c512048b0788d92b628b7564e54

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

require 'qusion'

module RCelery
  def self.thread
    @thread ||= Qusion.thread
  end

  module Rails
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rcelery-1.0.1 lib/rcelery/rails.rb
rcelery-1.0.0 lib/rcelery/rails.rb