Sha256: 1dcdea825887c230a20557779c5fd5dcf10260702de9dc0b9406bd049b720c94

Contents?: true

Size: 776 Bytes

Versions: 3

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  class Schema
    # A stand-in for a type which will be resolved in a given schema, by name.
    # TODO: support argument types too, make this a public API somehow
    # @api Private
    class LateBoundType
      attr_reader :name
      alias :graphql_name :name
      def initialize(local_name)
        @name = local_name
      end

      def unwrap
        self
      end

      def to_non_null_type
        @to_non_null_type ||= GraphQL::Schema::NonNull.new(self)
      end

      def to_list_type
        @to_list_type ||= GraphQL::Schema::List.new(self)
      end

      def inspect
        "#<LateBoundType @name=#{name}>"
      end

      def non_null?
        false
      end

      alias :to_s :inspect
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphql-2.0.16 lib/graphql/schema/late_bound_type.rb
graphql-2.0.15 lib/graphql/schema/late_bound_type.rb
graphql-2.0.14 lib/graphql/schema/late_bound_type.rb