Sha256: 31d9b9408721a3efc91387c3bce2f3713ef09c900f998409ac9baa7f270331c3

Contents?: true

Size: 834 Bytes

Versions: 10

Compression:

Stored size: 834 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  class Query
    # This object can be `ctx` in places where there is no query
    class NullContext
      class NullWarden < GraphQL::Schema::Warden
        def visible?(t); true; end
        def visible_field?(t); true; end
        def visible_type?(t); true; end
      end

      attr_reader :schema, :query, :warden

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

      def [](key); end

      class << self
        extend Forwardable

        def [](key); end

        def instance
          @instance = self.new
        end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
graphql-1.9.21 lib/graphql/query/null_context.rb
graphql-1.9.20 lib/graphql/query/null_context.rb
graphql-1.10.2 lib/graphql/query/null_context.rb
graphql-1.9.19 lib/graphql/query/null_context.rb
graphql-1.10.1 lib/graphql/query/null_context.rb
graphql-1.10.0 lib/graphql/query/null_context.rb
graphql-1.10.0.pre4 lib/graphql/query/null_context.rb
graphql-1.9.18 lib/graphql/query/null_context.rb
graphql-1.10.0.pre3 lib/graphql/query/null_context.rb
graphql-1.9.17 lib/graphql/query/null_context.rb