Module: RequestContext

Defined in:
lib/request_context.rb,
lib/request_context/version.rb

Constant Summary collapse

VERSION =
'0.0.4'

Class Method Summary collapse

Class Method Details

.request_contextObject

Returns Rack::Request.



20
21
22
# File 'lib/request_context.rb', line 20

def request_context
  Thread.current[:request_context]
end

.request_context=(request_context) ⇒ Object

Internal: Set the current request_context.

Examples

RequestContext.request_context = Rack::Request(env)
# => #<Rack::Request:0x007fe675a39950 @env={...}>

Returns the new Rack::Request request context.



32
33
34
# File 'lib/request_context.rb', line 32

def request_context=(request_context)
  Thread.current[:request_context] = request_context
end