class GraphQL::Client::Schema::NonNullType

Attributes

of_klass[R]

Internal: Get wrapped klass.

Returns BaseType instance.

Public Class Methods

new(of_klass) click to toggle source

Internal: Construct non-nullable wrapper from other BaseType.

of_klass - BaseType instance

# File lib/graphql/client/schema/non_null_type.rb, line 15
def initialize(of_klass)
  unless of_klass.is_a?(BaseType)
    raise TypeError, "expected #{of_klass.inspect} to be a #{BaseType}"
  end

  @of_klass = of_klass
end

Public Instance Methods

cast(value, errors) click to toggle source

Internal: Cast JSON value to wrapped value.

value - JSON value errors - Errors instance

Returns BaseType instance.

# File lib/graphql/client/schema/non_null_type.rb, line 34
def cast(value, errors)
  case value
  when NilClass
    raise InvariantError, "expected value to be non-nullable, but was nil"
  else
    of_klass.cast(value, errors)
  end
end
to_non_null_type() click to toggle source

Internal: Get non-nullable wrapper of this type class.

Returns NonNullType instance.

# File lib/graphql/client/schema/non_null_type.rb, line 46
def to_non_null_type
  self
end