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

null_request_store.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4642dcf9e9166b6db3d8ebcec80c36f424d15b29 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

# Used by Gitlab::SafeRequestStore
module Gitlab
  # The methods `begin!`, `clear!`, and `end!` are not defined because they
  # should only be called directly on `RequestStore`.
  class NullRequestStore
    def store
      {}
    end

    def active?
    end

    def read(key)
    end

    def [](key)
    end

    def write(key, value)
      value
    end

    def []=(key, value)
      value
    end

    def exist?(key)
      false
    end

    def fetch(key, &block)
      yield
    end

    def delete(key, &block)
      yield(key) if block
    end
  end
end