class T::Types::Simple

Validates that an object belongs to the specified class.

def initialize(raw_type)

def initialize(raw_type)
  @raw_type = raw_type
end

def name

@override Base
def name
  # Memoize to mitigate pathological performance with anonymous modules (https://bugs.ruby-lang.org/issues/11119)
  #
  # `name` isn't normally a hot path for types, but it is used in initializing a T::Types::Union,
  # and so in `T.nilable`, and so in runtime constructions like `x = T.let(nil, T.nilable(Integer))`.
  @name ||= @raw_type.name.freeze
end

def subtype_of_single?(other)

@override Base
def subtype_of_single?(other)
ther
imple
_type <= other.raw_type
e

def to_nilable

def to_nilable
  @nilable ||= T::Types::Union.new([self, T::Utils::Nilable::NIL_TYPE])
end

def valid?(obj)

@override Base
def valid?(obj)
  obj.is_a?(@raw_type)
end