Sha256: 23b6584e82393a37382e31bc4b869626cb2fe4c48cc8de376c17429868e67091

Contents?: true

Size: 593 Bytes

Versions: 4

Compression:

Stored size: 593 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  class Dataloader
    # @see Source#request_all which returns an instance of this.
    class RequestAll < Request
      def initialize(source, keys)
        @source = source
        @keys = keys
      end

      # Call this method to cause the current Fiber to wait for the results of this request.
      #
      # @return [Array<Object>] One object for each of `keys`
      def load
        if @keys.any? { |k| !@source.results.key?(k) }
          @source.sync
        end
        @keys.map { |k| @source.results[k] }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graphql-1.12.3 lib/graphql/dataloader/request_all.rb
graphql-1.12.2 lib/graphql/dataloader/request_all.rb
graphql-1.12.1 lib/graphql/dataloader/request_all.rb
graphql-1.12.0 lib/graphql/dataloader/request_all.rb