Class: Tapioca::Runtime::GenericTypeRegistry::GenericType
- Inherits:
-
T::Types::Base
- Object
- T::Types::Base
- Tapioca::Runtime::GenericTypeRegistry::GenericType
- Defined in:
- lib/tapioca/runtime/generic_type_registry.rb
Overview
Subclasses T::Types::Base rather than T::Types::Simple so that all
validation goes through the valid? override below. Simple fast paths
check raw_type directly, which for us is the clone, not the underlying type.
Instance Attribute Summary collapse
-
#raw_type ⇒ Object
readonly
: Module.
Instance Method Summary collapse
-
#build_type ⇒ Object
: -> nil.
- #initialize(raw_type, underlying_type) ⇒ GenericType constructor
-
#name ⇒ Object
: -> String.
-
#valid?(obj) ⇒ Boolean
: (untyped obj) -> bool.
Constructor Details
#initialize(raw_type, underlying_type) ⇒ GenericType
36 37 38 39 40 41 |
# File 'lib/tapioca/runtime/generic_type_registry.rb', line 36 def initialize(raw_type, ) super() @raw_type = raw_type @underlying_type = #: Module[top] end |
Instance Attribute Details
#raw_type ⇒ Object (readonly)
: Module
33 34 35 |
# File 'lib/tapioca/runtime/generic_type_registry.rb', line 33 def raw_type @raw_type end |
Instance Method Details
#build_type ⇒ Object
: -> nil
57 58 59 |
# File 'lib/tapioca/runtime/generic_type_registry.rb', line 57 def build_type nil end |
#name ⇒ Object
: -> String
51 52 53 |
# File 'lib/tapioca/runtime/generic_type_registry.rb', line 51 def name T.must(@raw_type.name) end |
#valid?(obj) ⇒ Boolean
: (untyped obj) -> bool
45 46 47 |
# File 'lib/tapioca/runtime/generic_type_registry.rb', line 45 def valid?(obj) obj.is_a?(@underlying_type) end |