Class: Yoda::Typing::Types::Instance
- Defined in:
- lib/yoda/typing/types/instance.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(klass:) ⇒ Instance
constructor
A new instance of Instance.
- #to_expression ⇒ Object
- #to_type_string ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(klass:) ⇒ Instance
Returns a new instance of Instance.
9 10 11 |
# File 'lib/yoda/typing/types/instance.rb', line 9 def initialize(klass:) @klass = klass end |
Instance Attribute Details
#klass ⇒ Stor::Objects::NamespaceObject (readonly)
6 7 8 |
# File 'lib/yoda/typing/types/instance.rb', line 6 def klass @klass end |
Instance Method Details
#to_expression ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/yoda/typing/types/instance.rb', line 13 def to_expression case klass.kind when :meta_class Model::TypeExpressions::ModuleType.new(klass.path) when :class, :module Model::TypeExpressions::InstanceType.new(klass.path) else fail NotImplementedError end end |
#to_type_string ⇒ Object
24 25 26 |
# File 'lib/yoda/typing/types/instance.rb', line 24 def to_type_string klass.path end |