Sha256: 7c9a1751f4e2e53b030989b0e830ae01dcab2a3adc0c82f8064acda66f831132

Contents?: true

Size: 595 Bytes

Versions: 34

Compression:

Stored size: 595 Bytes

Contents

module Incline::Extensions
  module CurrentRequest
    def self.included(base)
      base.class_eval do
        private
        
        def store_current_request
          ::Thread.current.thread_variable_set :incline_current_request, request
        end
        
        before_action :store_current_request
      end
    end
  end
end

module Incline
  def self.current_request
    th = ::Thread.current
    th.thread_variable?(:incline_current_request) ? th.thread_variable_get(:incline_current_request) : nil
  end
end

ActionController::Base.include ::Incline::Extensions::CurrentRequest

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
incline-0.3.14 lib/incline/extensions/current_request.rb
incline-0.3.13 lib/incline/extensions/current_request.rb
incline-0.3.12 lib/incline/extensions/current_request.rb
incline-0.3.11 lib/incline/extensions/current_request.rb
incline-0.3.10 lib/incline/extensions/current_request.rb
incline-0.3.9 lib/incline/extensions/current_request.rb
incline-0.3.8 lib/incline/extensions/current_request.rb
incline-0.3.7 lib/incline/extensions/current_request.rb
incline-0.3.6 lib/incline/extensions/current_request.rb
incline-0.3.5 lib/incline/extensions/current_request.rb
incline-0.3.4 lib/incline/extensions/current_request.rb
incline-0.3.3 lib/incline/extensions/current_request.rb
incline-0.3.2 lib/incline/extensions/current_request.rb
incline-0.3.1 lib/incline/extensions/current_request.rb
incline-0.3.0 lib/incline/extensions/current_request.rb
incline-0.2.36 lib/incline/extensions/current_request.rb
incline-0.2.35 lib/incline/extensions/current_request.rb
incline-0.2.34 lib/incline/extensions/current_request.rb
incline-0.2.28 lib/incline/extensions/current_request.rb
incline-0.2.27 lib/incline/extensions/current_request.rb