Sha256: d8b0434e78d51296e619c4b50e8db211422b206affec5dd58ee4990086b730e4

Contents?: true

Size: 886 Bytes

Versions: 4

Compression:

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

      def to_type_signature
        "#{@of_type.to_type_signature}!"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graphql-1.8.6 lib/graphql/schema/non_null.rb
graphql-1.8.5 lib/graphql/schema/non_null.rb
graphql-1.8.4 lib/graphql/schema/non_null.rb
graphql-1.8.3 lib/graphql/schema/non_null.rb