Sha256: 2534b14345309be66acf47c3fedb10653376d16c9763508647130e0ff23900a7

Contents?: true

Size: 762 Bytes

Versions: 3

Compression:

Stored size: 762 Bytes

Contents

require 'rails'

module Outbox
  module Rails
    class Railtie < ::Rails::Railtie
      config.outbox = ActiveSupport::OrderedOptions.new

      initializer 'outbox.logger' do
        ActiveSupport.on_load(:outbox_notifier) do
          self.logger ||= ::Rails.logger
        end
      end

      initializer 'outbox.config' do |app|
        options = app.config.outbox

        ActiveSupport.on_load(:outbox) do
          Outbox::Message.use_test_client if options.delete(:use_test_client)

          options.each do |key, value|
            option_setter = "#{key}="
            if Outbox::Message.respond_to?(option_setter)
              Outbox::Message.public_send(option_setter, value)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
outbox-rails-1.0.0 lib/outbox/rails/railtie.rb
outbox-rails-0.5.1 lib/outbox/rails/railtie.rb
outbox-rails-0.5.0 lib/outbox/rails/railtie.rb