Sha256: 28ff304c2b3827da03086e6daf4022cfd7151056cbfc06a6d689a937ddd9062e

Contents?: true

Size: 1015 Bytes

Versions: 49

Compression:

Stored size: 1015 Bytes

Contents

# frozen_string_literal: true

module LHS
  class Railtie < Rails::Railtie
    initializer "lhs.hook_into_controller_initialization" do
      class ActionController::Base

        def initialize
          prepare_lhs_request_cycle_cache
          reset_option_blocks
          reset_extended_rollbar_request_logs
          super
        end

        private

        def prepare_lhs_request_cycle_cache
          return unless LHS.config.request_cycle_cache_enabled
          LHS::Interceptors::RequestCycleCache::ThreadRegistry.request_id = [Time.now.to_f, request.object_id].join('#')
        end

        def reset_option_blocks
          LHS::OptionBlocks::CurrentOptionBlock.options = nil
        end

        def reset_extended_rollbar_request_logs
          return unless defined?(::Rollbar)
          return unless LHC.config.interceptors.include?(LHS::Interceptors::ExtendedRollbar::Interceptor)
          LHS::Interceptors::ExtendedRollbar::ThreadRegistry.log = []
        end
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
lhs-26.2.0 lib/lhs/railtie.rb
lhs-26.1.0 lib/lhs/railtie.rb
lhs-26.0.1 lib/lhs/railtie.rb
lhs-26.0.0 lib/lhs/railtie.rb
lhs-25.2.0 lib/lhs/railtie.rb
lhs-25.1.0 lib/lhs/railtie.rb
lhs-25.0.4 lib/lhs/railtie.rb
lhs-25.0.3 lib/lhs/railtie.rb
lhs-25.0.2 lib/lhs/railtie.rb
lhs-25.0.1 lib/lhs/railtie.rb
lhs-25.0.0 lib/lhs/railtie.rb
lhs-24.1.2 lib/lhs/railtie.rb
lhs-24.1.1 lib/lhs/railtie.rb
lhs-24.1.0 lib/lhs/railtie.rb
lhs-24.1.0.pre.2 lib/lhs/railtie.rb
lhs-24.1.0.pre.1 lib/lhs/railtie.rb
lhs-24.0.0 lib/lhs/railtie.rb
lhs-23.0.2 lib/lhs/railtie.rb
lhs-23.0.1 lib/lhs/railtie.rb
lhs-23.0.0 lib/lhs/railtie.rb