Sha256: 3a72dfb8065a4303f65e85796839bdce97211542f1a1ffb71f7f14489d3d35e7

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  class Schema
    # Wraps a {Schema::Member} when it is required.
    # @see {Schema::Member::TypeSystemHelpers#to_non_null_type}
    class NonNull
      include GraphQL::Schema::Member::CachedGraphQLDefinition
      include GraphQL::Schema::Member::TypeSystemHelpers
      attr_reader :of_type
      def initialize(of_type)
        @of_type = of_type
      end

      def to_graphql
        @of_type.graphql_definition.to_non_null_type
      end

      # @return [true]
      def non_null?
        true
      end

      # @return [Boolean] True if this type wraps a list type
      def list?
        @of_type.list?
      end

      def kind
        GraphQL::TypeKinds::NON_NULL
      end

      def unwrap
        @of_type.unwrap
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphql-1.8.2 lib/graphql/schema/non_null.rb
graphql-1.8.1 lib/graphql/schema/non_null.rb
graphql-1.8.0 lib/graphql/schema/non_null.rb