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

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

28 lines
409 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
module Gitlab
class NamespacedSessionStore
delegate :[], :[]=, to: :store
2019-09-30 21:07:59 +05:30
def initialize(key, session = Session.current)
2019-07-31 22:56:46 +05:30
@key = key
2019-09-30 21:07:59 +05:30
@session = session
2019-07-31 22:56:46 +05:30
end
def initiated?
2019-09-30 21:07:59 +05:30
!session.nil?
2019-07-31 22:56:46 +05:30
end
def store
2019-09-30 21:07:59 +05:30
return unless session
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
session[@key] ||= {}
session[@key]
2019-07-31 22:56:46 +05:30
end
2019-09-30 21:07:59 +05:30
private
attr_reader :session
2019-07-31 22:56:46 +05:30
end
end