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.2.26 lib/incline/extensions/current_request.rb
incline-0.2.25 lib/incline/extensions/current_request.rb
incline-0.2.24 lib/incline/extensions/current_request.rb
incline-0.2.23 lib/incline/extensions/current_request.rb
incline-0.2.22 lib/incline/extensions/current_request.rb
incline-0.2.21 lib/incline/extensions/current_request.rb
incline-0.2.20 lib/incline/extensions/current_request.rb
incline-0.2.19 lib/incline/extensions/current_request.rb
incline-0.2.18 lib/incline/extensions/current_request.rb
incline-0.2.17 lib/incline/extensions/current_request.rb
incline-0.2.16 lib/incline/extensions/current_request.rb
incline-0.2.15 lib/incline/extensions/current_request.rb
incline-0.2.14 lib/incline/extensions/current_request.rb
incline-0.2.13 lib/incline/extensions/current_request.rb