Class: Yoda::Typing::Types::SingletonType
- Inherits:
-
Object
- Object
- Yoda::Typing::Types::SingletonType
- Extended by:
- Forwardable
- Includes:
- RbsTypeWrapperInterface
- Defined in:
- lib/yoda/typing/types/singleton_type.rb
Instance Attribute Summary collapse
- #instance_type ⇒ Type, SingletonType readonly
Instance Method Summary collapse
-
#initialize(instance_type) ⇒ SingletonType
constructor
A new instance of SingletonType.
-
#klass ⇒ Store::Objects::Base
deprecated
Deprecated.
Use #value to access referred objects.
- #pretty_print(pp) ⇒ Object
- #rbs_type ⇒ RBS::Types::t
- #singleton_type ⇒ SingletonType
- #to_s ⇒ String
- #value ⇒ Model::Values::Base
Methods included from RbsTypeWrapperInterface
Constructor Details
#initialize(instance_type) ⇒ SingletonType
Returns a new instance of SingletonType.
18 19 20 |
# File 'lib/yoda/typing/types/singleton_type.rb', line 18 def initialize(instance_type) @instance_type = instance_type end |
Instance Attribute Details
#instance_type ⇒ Type, SingletonType (readonly)
12 |
# File 'lib/yoda/typing/types/singleton_type.rb', line 12 delegate environment: :instance_type |
Instance Method Details
#klass ⇒ Store::Objects::Base
Deprecated.
Use #value to access referred objects.
39 40 41 |
# File 'lib/yoda/typing/types/singleton_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/singleton_type.rb', line 49 def pretty_print(pp) pp.object_group(self) do pp.breakable pp.text "@rbs_type=" pp.pp rbs_type.to_s end end |
#rbs_type ⇒ RBS::Types::t
23 24 25 |
# File 'lib/yoda/typing/types/singleton_type.rb', line 23 def rbs_type @rbs_type ||= make_singleton(instance_type.rbs_type) end |
#singleton_type ⇒ SingletonType
33 34 35 |
# File 'lib/yoda/typing/types/singleton_type.rb', line 33 def singleton_type SingletonType.new(self) end |
#to_s ⇒ String
44 45 46 |
# File 'lib/yoda/typing/types/singleton_type.rb', line 44 def to_s rbs_type.to_s end |
#value ⇒ Model::Values::Base
28 29 30 |
# File 'lib/yoda/typing/types/singleton_type.rb', line 28 def value @value ||= instance_type.value.singleton_class_value end |