Sha256: a9da0efb5ce3bb57378a35ff89893f49e1d82432a6934db4f60a0e6e2f64b40d

Contents?: true

Size: 768 Bytes

Versions: 3

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  class Schema
    # Represents a list type in the schema.
    # Wraps a {Schema::Member} as a list type.
    # @see {Schema::Member::TypeSystemHelpers#to_list_type}
    class List
      include GraphQL::Schema::Member::CachedGraphQLDefinition
      include GraphQL::Schema::Member::TypeSystemHelpers

      # @return [Class, Module] The inner type of this list, the type of which one or more objects may be present.
      attr_reader :of_type

      def initialize(of_type)
        @of_type = of_type
      end

      def to_graphql
        @of_type.graphql_definition.to_list_type
      end

      def kind
        GraphQL::TypeKinds::LIST
      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/list.rb
graphql-1.8.1 lib/graphql/schema/list.rb
graphql-1.8.0 lib/graphql/schema/list.rb