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

lazy.rb « graphql « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a7f7610a041007640d1e715806996e432099d937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module Gitlab
  module Graphql
    class Lazy
      # Force evaluation of a (possibly) lazy value
      def self.force(value)
        case value
        when ::BatchLoader::GraphQL
          value.sync
        when ::Concurrent::Promise
          value.execute.value
        else
          value
        end
      end
    end
  end
end