Sha256: 85f7a87e1470e9137049863c6eebc8a3861bb2d2343cdaf9b0735f2bd7b82144

Contents?: true

Size: 790 Bytes

Versions: 25

Compression:

Stored size: 790 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 GraphQL::Delegate

        def instance
          @instance = self.new
        end

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
graphql-1.8.0.pre10 lib/graphql/query/null_context.rb
graphql-1.7.14 lib/graphql/query/null_context.rb
graphql-1.8.0.pre9 lib/graphql/query/null_context.rb
graphql-1.8.0.pre8 lib/graphql/query/null_context.rb
graphql-1.7.13 lib/graphql/query/null_context.rb
graphql-1.8.0.pre7 lib/graphql/query/null_context.rb
graphql-1.7.12 lib/graphql/query/null_context.rb
graphql-1.7.11 lib/graphql/query/null_context.rb
graphql-1.7.10 lib/graphql/query/null_context.rb
graphql-1.8.0.pre6 lib/graphql/query/null_context.rb
graphql-1.8.0.pre5 lib/graphql/query/null_context.rb
graphql-1.7.9 lib/graphql/query/null_context.rb
graphql-1.8.0.pre4 lib/graphql/query/null_context.rb
graphql-1.8.0.pre3 lib/graphql/query/null_context.rb
graphql-1.7.8 lib/graphql/query/null_context.rb
graphql-1.8.0.pre2 lib/graphql/query/null_context.rb
graphql-1.7.7 lib/graphql/query/null_context.rb
graphql-1.8.0.pre1 lib/graphql/query/null_context.rb
graphql-1.7.6 lib/graphql/query/null_context.rb
graphql-1.7.5 lib/graphql/query/null_context.rb