Class: Rigor::Cache::RbsConstantTable

Inherits:
Object
  • Object
show all
Defined in:
lib/rigor/cache/rbs_constant_table.rb

Overview

Cache producer that materialises every RBS-declared constant to its translated ‘Rigor::Type` form and stores the result as a `Hash<String, Rigor::Type>` keyed by canonical constant name. This is the v0.0.8 first cached producer per ADR-6 § 7; it caches a post-translation artefact so the cache value is `Marshal`-clean (RBS-native objects carry `RBS::Location`, which lacks `_dump_data`).

Cache descriptor:

  • ‘gems`: the `rbs` gem (with the locked version) so a gem upgrade invalidates the table — bundled core + stdlib signatures live inside the gem.

  • ‘files`: the digest of every `.rbs` file under the loader’s ‘signature_paths` (project-supplied signatures that the gem’s locked version cannot cover).

  • ‘configs`: the SHA-256 of the loader’s libraries list so adding/removing a stdlib library invalidates.

Constant Summary collapse

PRODUCER_ID =
"rbs.constant_type_table"

Class Method Summary collapse

Class Method Details

.fetch(loader:, store:) ⇒ Hash{String => Rigor::Type}

Parameters:

Returns:



31
32
33
34
35
36
# File 'lib/rigor/cache/rbs_constant_table.rb', line 31

def self.fetch(loader:, store:)
  descriptor = build_descriptor(loader)
  store.fetch_or_compute(producer_id: PRODUCER_ID, params: {}, descriptor: descriptor) do
    compute(loader)
  end
end