Class: Tapioca::Runtime::GenericTypeRegistry::GenericType

Inherits:
T::Types::Simple show all
Extended by:
T::Sig
Defined in:
lib/tapioca/runtime/generic_type_registry.rb

Constant Summary

Constants included from T::Types::Simple::NamePatch

T::Types::Simple::NamePatch::NAME_METHOD

Instance Method Summary collapse

Methods included from T::Types::Simple::NamePatch

#name, #qualified_name_of

Methods included from T::Types::Simple::GenericPatch

#name

Constructor Details

#initialize(raw_type, underlying_type) ⇒ GenericType

Returns a new instance of GenericType.



38
39
40
41
42
# File 'lib/tapioca/runtime/generic_type_registry.rb', line 38

def initialize(raw_type, underlying_type)
  super(raw_type)

  @underlying_type = T.let(underlying_type, Module)
end

Instance Method Details

#valid?(obj) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/tapioca/runtime/generic_type_registry.rb', line 45

def valid?(obj)
  obj.is_a?(@underlying_type)
end