Sha256: 4011794e7471fae3af16167fdd3a71b3933925261a3e9e200f7eadbee0ea4019

Contents?: true

Size: 908 Bytes

Versions: 9

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

module DHS
  class Railtie < Rails::Railtie

    class ::ActionController::Base

      def initialize
        prepare_dhs_request_cycle_cache
        reset_option_blocks
        reset_extended_rollbar_request_logs
        super
      end

      private

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

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

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

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dhs-1.6.0 lib/dhs/railtie/action_controller_extension.rb
dhs-1.5.0 lib/dhs/railtie/action_controller_extension.rb
dhs-1.4.2 lib/dhs/railtie/action_controller_extension.rb
dhs-1.4.1 lib/dhs/railtie/action_controller_extension.rb
dhs-1.4.0 lib/dhs/railtie/action_controller_extension.rb
dhs-1.3.0 lib/dhs/railtie/action_controller_extension.rb
dhs-1.2.0 lib/dhs/railtie/action_controller_extension.rb
dhs-1.1.0 lib/dhs/railtie/action_controller_extension.rb
dhs-1.0.3 lib/dhs/railtie/action_controller_extension.rb