Sha256: 5e5356c2d7c6dc4f6a20621580d977267f4ec01c02fdfe16ceaf9c29af83e7cf

Contents?: true

Size: 627 Bytes

Versions: 11

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  class Query
    # This object can be `ctx` in places where there is no query
    class NullContext
      attr_reader :schema, :query, :warden

      def initialize
        @query = nil
        @schema = GraphQL::Schema.new
        @warden = GraphQL::Schema::Warden.new(
          GraphQL::Schema::NullMask,
          context: self,
          schema: @schema,
        )
      end

      class << self
        extend Forwardable

        def instance
          @instance = self.new
        end

        def_delegators :instance, :query, :schema, :warden
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
graphql-1.5.15 lib/graphql/query/null_context.rb
graphql-1.5.14 lib/graphql/query/null_context.rb
graphql-1.5.13 lib/graphql/query/null_context.rb
graphql-1.5.7.1 lib/graphql/query/null_context.rb
graphql-1.5.12 lib/graphql/query/null_context.rb
graphql-1.5.11 lib/graphql/query/null_context.rb
graphql-1.5.10 lib/graphql/query/null_context.rb
graphql-1.5.9 lib/graphql/query/null_context.rb
graphql-1.5.8 lib/graphql/query/null_context.rb
graphql-1.5.7 lib/graphql/query/null_context.rb
graphql-1.5.6 lib/graphql/query/null_context.rb