Class: TypeProf::Type::Instance
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::TypeProf::Type
|
|
Instance Chain:
|
|
Inherits: |
TypeProf::Type
|
Defined in: | lib/typeprof/type.rb |
Constant Summary
::TypeProf::Type
- Inherited
Class Method Summary
::TypeProf::Type
- Inherited
Instance Attribute Summary
- #include_subclasses readonly
- #klass readonly
Instance Method Summary
- #consistent?(other) ⇒ Boolean
- #inspect
- #method_dispatch_info
- #screen_name(scratch)
- #substitute(subst, depth)
::TypeProf::Type
- Inherited
Constructor Details
.new(klass, include_subclasses = false) ⇒ Instance
Class Method Details
.new_degenerate(instances)
[ GitHub ]# File 'lib/typeprof/type.rb', line 546
def self.new_degenerate(instances) klass = instances.first.klass ancestors = [] ancestor_idxs = {} while klass != :__root__ ancestor_idxs[klass] = ancestors.size ancestors << klass klass = klass.superclass end common_superclass = nil instances[1..].each do |instance| klass = instance.klass while !ancestor_idxs[klass] klass = klass.superclass end common_superclass = klass ancestor_idxs[klass].times do |i| ancestor_idxs.delete(ancestors[i]) ancestors[i] = nil end end new(common_superclass, true) end
Instance Attribute Details
#include_subclasses (readonly)
[ GitHub ]# File 'lib/typeprof/type.rb', line 570
attr_reader :klass, :include_subclasses
#klass (readonly)
[ GitHub ]# File 'lib/typeprof/type.rb', line 570
attr_reader :klass, :include_subclasses
Instance Method Details
#consistent?(other) ⇒ Boolean
#inspect
[ GitHub ]# File 'lib/typeprof/type.rb', line 572
def inspect "I[#{ @klass.inspect }]" end
#method_dispatch_info
[ GitHub ]# File 'lib/typeprof/type.rb', line 586
def method_dispatch_info [@klass, false, @include_subclasses] end
#screen_name(scratch)
[ GitHub ]#substitute(subst, depth)
[ GitHub ]# File 'lib/typeprof/type.rb', line 602
def substitute(subst, depth) Instance.new(@klass.substitute(subst, depth)) end