Sha256: 464d37b13513dc57a1bfbc1262708bf06c3882b4be770b29003162e28b39d452

Contents?: true

Size: 845 Bytes

Versions: 14

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true
require "graphql/query/context"
module GraphQL
  class Query
    # This object can be `ctx` in places where there is no query
    class NullContext < Context
      include Singleton

      class NullQuery
        def after_lazy(value)
          yield(value)
        end
      end

      class NullSchema < GraphQL::Schema
      end

      extend Forwardable

      attr_reader :schema, :query, :warden, :dataloader
      def_delegators GraphQL::EmptyObjects::EMPTY_HASH, :[], :fetch, :dig, :key?, :to_h

      def initialize
        @query = NullQuery.new
        @dataloader = GraphQL::Dataloader::NullDataloader.new
        @schema = NullSchema
        @warden = Schema::Warden::NullWarden.new(context: self, schema: @schema)
        @types = @warden.visibility_profile
        freeze
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
graphql-2.4.14 lib/graphql/query/null_context.rb
graphql-2.4.13 lib/graphql/query/null_context.rb
graphql-2.4.12 lib/graphql/query/null_context.rb
graphql-2.4.11 lib/graphql/query/null_context.rb
graphql-2.4.10 lib/graphql/query/null_context.rb
graphql-2.4.9 lib/graphql/query/null_context.rb
graphql-2.4.8 lib/graphql/query/null_context.rb
graphql-2.4.7 lib/graphql/query/null_context.rb
graphql-2.4.6 lib/graphql/query/null_context.rb
graphql-2.4.5 lib/graphql/query/null_context.rb
graphql-2.4.4 lib/graphql/query/null_context.rb
graphql-2.4.3 lib/graphql/query/null_context.rb
graphql-2.4.2 lib/graphql/query/null_context.rb
graphql-2.4.1 lib/graphql/query/null_context.rb