Sha256: ef3f72de1d2cd1769f6a364909358f64b57925bd1c760567cf9978d97081a474

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 Bytes

Contents

module MessageQueue
  def self.hook_rails!
    MessageQueue::Logging.logger = ::Rails.logger

    config_file = ::Rails.root.join("config", "message_queue.yml")
    config = if config_file.exist?
               HashWithIndifferentAccess.new YAML.load_file(config_file)[::Rails.env]
             else
               { :adapter => :memory, :serializer => :json }
             end
    MessageQueue.connect(config)
  end

  class Rails < ::Rails::Engine
    initializer "message_queue" do
      MessageQueue.hook_rails!
    end
  end if defined?(::Rails)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
message_queue-0.1.1 lib/message_queue/rails.rb
message_queue-0.1.0 lib/message_queue/rails.rb