Sha256: ea9f024e807a29e5a1b36e0c0e7bfb406fec8440a34f5b8045b216ff10c379b0

Contents?: true

Size: 598 Bytes

Versions: 9

Compression:

Stored size: 598 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 coerce_result(value)
    of_type.coerce_result(value)
  end

  def kind
    GraphQL::TypeKinds::NON_NULL
  end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
graphql-0.10.9 lib/graphql/non_null_type.rb
graphql-0.10.8 lib/graphql/non_null_type.rb
graphql-0.10.7 lib/graphql/non_null_type.rb
graphql-0.10.6 lib/graphql/non_null_type.rb
graphql-0.10.5 lib/graphql/non_null_type.rb
graphql-0.10.4 lib/graphql/non_null_type.rb
graphql-0.10.3 lib/graphql/non_null_type.rb
graphql-0.10.2 lib/graphql/non_null_type.rb
graphql-0.10.1 lib/graphql/non_null_type.rb