Class: Rigor::Environment::RbsHierarchy
- Inherits:
-
Object
- Object
- Rigor::Environment::RbsHierarchy
- Defined in:
- lib/rigor/environment/rbs_hierarchy.rb
Overview
Small hierarchy oracle backed by RBS instance definitions.
Instance Method Summary collapse
- #class_ordering(lhs, rhs) ⇒ Object
-
#initialize(loader) ⇒ RbsHierarchy
constructor
A new instance of RbsHierarchy.
Constructor Details
#initialize(loader) ⇒ RbsHierarchy
Returns a new instance of RbsHierarchy.
7 8 9 10 11 |
# File 'lib/rigor/environment/rbs_hierarchy.rb', line 7 def initialize(loader) @loader = loader @ancestor_names_cache = {} @class_ordering_cache = {} end |
Instance Method Details
#class_ordering(lhs, rhs) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rigor/environment/rbs_hierarchy.rb', line 13 def class_ordering(lhs, rhs) lhs = normalize_name(lhs) rhs = normalize_name(rhs) return :equal if lhs == rhs key = [lhs, rhs] return @class_ordering_cache[key] if @class_ordering_cache.key?(key) @class_ordering_cache[key] = compute_class_ordering(lhs, rhs) end |