Sha256: f2f9a27ff4561345d2f9867d4af89b839d59f8bc40144ebacf7d32b43fe37aad

Contents?: true

Size: 897 Bytes

Versions: 27

Compression:

Stored size: 897 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

      def interpreter?
        false
      end

      class << self
        extend Forwardable

        def [](key); end

        def instance
          @instance = self.new
        end

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

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
graphql-1.11.10 lib/graphql/query/null_context.rb
graphql-1.11.9 lib/graphql/query/null_context.rb
graphql-1.11.8 lib/graphql/query/null_context.rb
graphql-1.12.3 lib/graphql/query/null_context.rb
graphql-1.12.2 lib/graphql/query/null_context.rb
graphql-1.12.1 lib/graphql/query/null_context.rb
graphql-1.12.0 lib/graphql/query/null_context.rb
graphql-1.11.7 lib/graphql/query/null_context.rb
graphql-1.11.6 lib/graphql/query/null_context.rb
graphql-1.11.5 lib/graphql/query/null_context.rb
graphql-1.11.4 lib/graphql/query/null_context.rb
graphql-1.11.3 lib/graphql/query/null_context.rb
graphql-1.11.2 lib/graphql/query/null_context.rb
graphql-1.10.14 lib/graphql/query/null_context.rb
graphql-1.11.1 lib/graphql/query/null_context.rb
graphql-1.10.13 lib/graphql/query/null_context.rb
graphql-1.11.0 lib/graphql/query/null_context.rb
graphql-1.10.12 lib/graphql/query/null_context.rb
graphql-1.10.11 lib/graphql/query/null_context.rb
graphql-1.10.10 lib/graphql/query/null_context.rb