Sha256: 31995f021b036ab13e135a5398fb78a1ace76a88e3b6c5f31c60b14a3ca83b7b

Contents?: true

Size: 784 Bytes

Versions: 43

Compression:

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

      class << self
        extend Forwardable

        def instance
          @instance = self.new
        end

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

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
graphql-1.9.1 lib/graphql/query/null_context.rb
graphql-1.9.0 lib/graphql/query/null_context.rb
graphql-1.8.15 lib/graphql/query/null_context.rb
graphql-1.9.0.pre4 lib/graphql/query/null_context.rb
graphql-1.8.14 lib/graphql/query/null_context.rb
graphql-1.9.0.pre3 lib/graphql/query/null_context.rb
graphql-1.9.0.pre2 lib/graphql/query/null_context.rb
graphql-1.8.13 lib/graphql/query/null_context.rb
graphql-1.8.12 lib/graphql/query/null_context.rb
graphql-1.9.0.pre1 lib/graphql/query/null_context.rb
graphql-1.8.11 lib/graphql/query/null_context.rb
graphql-1.8.10 lib/graphql/query/null_context.rb
graphql-1.8.9 lib/graphql/query/null_context.rb
graphql-1.8.8 lib/graphql/query/null_context.rb
graphql-1.8.7 lib/graphql/query/null_context.rb
graphql-1.8.6 lib/graphql/query/null_context.rb
graphql-1.8.5 lib/graphql/query/null_context.rb
graphql-1.8.4 lib/graphql/query/null_context.rb
graphql-1.8.3 lib/graphql/query/null_context.rb
graphql-1.8.2 lib/graphql/query/null_context.rb