Sha256: cfda194873cc976a0d49f8e5277b9f53b9df547200f015a7c88ffebb2b73a6e1

Contents?: true

Size: 482 Bytes

Versions: 1

Compression:

Stored size: 482 Bytes

Contents

# A list type wraps another type.
#
# Get the underlying type with {#unwrap}
class GraphQL::ListType < GraphQL::BaseType
  include GraphQL::BaseType::ModifiesAnotherType
  attr_reader :of_type, :name
  def initialize(of_type:)
    @name = "List"
    @of_type = of_type
  end

  def kind
    GraphQL::TypeKinds::LIST
  end

  def to_s
    "[#{of_type.to_s}]"
  end

  def coerce_input(value)
    inner_type = of_type
    value.map { |item| inner_type.coerce_input!(item) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-0.10.0 lib/graphql/list_type.rb