Sha256: 5a056d349234d80a867e0759e930dd48a97e77c5dd9c563b64ad703a99aed6d7

Contents?: true

Size: 864 Bytes

Versions: 15

Compression:

Stored size: 864 Bytes

Contents

module Timber
  module Frameworks
    module Rails
      # Installs Timber into your Rails app automatically.
      class Railtie < ::Rails::Railtie
        config.timber = Config.instance
        config.before_initialize do
          Probes.insert!
          Timber::Frameworks::Rails.insert_middlewares(config.app_middleware)
        end
      end

      def self.insert_middlewares(middleware)
        var_name = :"@_timber_middlewares_inserted"
        return true if middleware.instance_variable_defined?(var_name) && middleware.instance_variable_get(var_name) == true
        # Rails uses a proxy :/, so we need to do this instance variable hack
        middleware.instance_variable_set(var_name, true)
        Timber::RackMiddlewares.middlewares.each do |m|
          middleware.insert_before ::Rails::Rack::Logger, m
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
timber-1.1.14 lib/timber/frameworks/rails.rb
timber-1.1.13 lib/timber/frameworks/rails.rb
timber-1.1.12 lib/timber/frameworks/rails.rb
timber-1.1.11 lib/timber/frameworks/rails.rb
timber-1.1.10 lib/timber/frameworks/rails.rb
timber-1.1.9 lib/timber/frameworks/rails.rb
timber-1.1.8 lib/timber/frameworks/rails.rb
timber-1.1.7 lib/timber/frameworks/rails.rb
timber-1.1.6 lib/timber/frameworks/rails.rb
timber-1.1.5 lib/timber/frameworks/rails.rb
timber-1.1.4 lib/timber/frameworks/rails.rb
timber-1.1.3 lib/timber/frameworks/rails.rb
timber-1.1.2 lib/timber/frameworks/rails.rb
timber-1.1.1 lib/timber/frameworks/rails.rb
timber-1.1.0 lib/timber/frameworks/rails.rb