Class: Steep::Subtyping::Cache
Instance Attribute Summary collapse
-
#subtypes ⇒ Object
readonly
Returns the value of attribute subtypes.
Instance Method Summary collapse
- #[](relation, self_type, instance_type, class_type, bounds) ⇒ Object
- #[]=(relation, self_type, instance_type, class_type, bounds, value) ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
- #no_subtype_cache? ⇒ Boolean
- #subtype(relation, self_type, instance_type, class_type, bounds) ⇒ Object
Constructor Details
#initialize ⇒ Cache
Returns a new instance of Cache.
6 7 8 |
# File 'lib/steep/subtyping/cache.rb', line 6 def initialize @subtypes = {} end |
Instance Attribute Details
#subtypes ⇒ Object (readonly)
Returns the value of attribute subtypes.
4 5 6 |
# File 'lib/steep/subtyping/cache.rb', line 4 def subtypes @subtypes end |
Instance Method Details
#[](relation, self_type, instance_type, class_type, bounds) ⇒ Object
15 16 17 18 |
# File 'lib/steep/subtyping/cache.rb', line 15 def [](relation, self_type, instance_type, class_type, bounds) key = [relation, self_type, instance_type, class_type, bounds] subtypes[key] end |
#[]=(relation, self_type, instance_type, class_type, bounds, value) ⇒ Object
20 21 22 23 |
# File 'lib/steep/subtyping/cache.rb', line 20 def []=(relation, self_type, instance_type, class_type, bounds, value) key = [relation, self_type, instance_type, class_type, bounds] subtypes[key] = value end |
#no_subtype_cache? ⇒ Boolean
25 26 27 |
# File 'lib/steep/subtyping/cache.rb', line 25 def no_subtype_cache? @subtypes.empty? end |
#subtype(relation, self_type, instance_type, class_type, bounds) ⇒ Object
10 11 12 13 |
# File 'lib/steep/subtyping/cache.rb', line 10 def subtype(relation, self_type, instance_type, class_type, bounds) key = [relation, self_type, instance_type, class_type, bounds] subtypes[key] end |