Welcome to mirror list, hosted at ThFree Co, Russian Federation.

namespaced_session_store.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f0f24c081c3b62267d09a45ff716d4fc53979cea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Gitlab
  class NamespacedSessionStore
    delegate :[], :[]=, to: :store

    def initialize(key, session = Session.current)
      @key = key
      @session = session
    end

    def initiated?
      !session.nil?
    end

    def store
      return unless session

      session[@key] ||= {}
      session[@key]
    end

    private

    attr_reader :session
  end
end