debian-mirror-gitlab/lib/gitlab/session.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
444 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
module Gitlab
class Session
STORE_KEY = :session_storage
class << self
def with_session(session)
old = self.current
self.current = session
yield
ensure
self.current = old
end
def current
Thread.current[STORE_KEY]
end
protected
def current=(value)
Thread.current[STORE_KEY] = value
end
end
end
end