Sha256: 9b888311632143519e523c9f7eb8bd8c534dbb60a8f3897182804f52008ea05b

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

# A non-null type wraps another type.
#
# Get the underlying type with {#unwrap}
class GraphQL::NonNullType < GraphQL::BaseType
  include GraphQL::BaseType::ModifiesAnotherType

  attr_reader :of_type
  def initialize(of_type:)
    @of_type = of_type
  end

  def name
    "Non-Null"
  end

  def valid_input?(value)
    !value.nil? && of_type.valid_input?(value)
  end

  def coerce_input(value)
    of_type.coerce_input(value)
  end

  def kind
    GraphQL::TypeKinds::NON_NULL
  end

  def to_s
    "#{of_type.to_s}!"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-0.11.0 lib/graphql/non_null_type.rb