Class: Yoda::Typing::Types::Type
- Inherits:
-
Object
- Object
- Yoda::Typing::Types::Type
- Includes:
- RbsTypeWrapperInterface
- Defined in:
- lib/yoda/typing/types/type.rb
Instance Attribute Summary collapse
- #environment ⇒ Model::Environment readonly
- #rbs_type ⇒ RBS::Types::t readonly
Instance Method Summary collapse
-
#initialize(environment:, rbs_type:) ⇒ Type
constructor
A new instance of Type.
- #instance_type ⇒ InstanceType
-
#klass ⇒ Store::Objects::Base
deprecated
Deprecated.
Use #value to access referred objects.
- #pretty_print(pp) ⇒ Object
- #singleton_type ⇒ SingletonType
- #to_s ⇒ String
- #value ⇒ Model::Values::Base
Constructor Details
#initialize(environment:, rbs_type:) ⇒ Type
Returns a new instance of Type.
17 18 19 20 |
# File 'lib/yoda/typing/types/type.rb', line 17 def initialize(environment:, rbs_type:) @environment = environment @rbs_type = rbs_type end |
Instance Attribute Details
#environment ⇒ Model::Environment (readonly)
10 11 12 |
# File 'lib/yoda/typing/types/type.rb', line 10 def environment @environment end |
#rbs_type ⇒ RBS::Types::t (readonly)
13 14 15 |
# File 'lib/yoda/typing/types/type.rb', line 13 def rbs_type @rbs_type end |
Instance Method Details
#instance_type ⇒ InstanceType
28 29 30 |
# File 'lib/yoda/typing/types/type.rb', line 28 def instance_type InstanceType.new(self) end |
#klass ⇒ Store::Objects::Base
Deprecated.
Use #value to access referred objects.
39 40 41 |
# File 'lib/yoda/typing/types/type.rb', line 39 def klass value.referred_objects.first end |
#pretty_print(pp) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/yoda/typing/types/type.rb', line 49 def pretty_print(pp) pp.object_group(self) do pp.breakable pp.text "type:" pp.pp rbs_type.to_s end end |
#singleton_type ⇒ SingletonType
33 34 35 |
# File 'lib/yoda/typing/types/type.rb', line 33 def singleton_type SingletonType.new(self) end |
#to_s ⇒ String
44 45 46 |
# File 'lib/yoda/typing/types/type.rb', line 44 def to_s rbs_type.to_s end |
#value ⇒ Model::Values::Base
23 24 25 |
# File 'lib/yoda/typing/types/type.rb', line 23 def value @value ||= environment.resolve_value_by_rbs_type(rbs_type) end |