Class: Scrapetor::TemplateRegistry
- Inherits:
-
Object
- Object
- Scrapetor::TemplateRegistry
- Defined in:
- lib/scrapetor/template_registry.rb
Overview
Phase 1: in-process registry mapping structural fingerprints to compiled extraction plans (Schema instances). Phase 8 (per plan.md) promotes this to an mmap-backed cross-process store.
Instance Method Summary collapse
- #fetch(fingerprint) ⇒ Object
-
#initialize ⇒ TemplateRegistry
constructor
A new instance of TemplateRegistry.
- #size ⇒ Object
- #store(fingerprint, plan) ⇒ Object
Constructor Details
#initialize ⇒ TemplateRegistry
Returns a new instance of TemplateRegistry.
8 9 10 |
# File 'lib/scrapetor/template_registry.rb', line 8 def initialize @plans = {} end |
Instance Method Details
#fetch(fingerprint) ⇒ Object
16 17 18 |
# File 'lib/scrapetor/template_registry.rb', line 16 def fetch(fingerprint) @plans[fingerprint] end |
#size ⇒ Object
20 21 22 |
# File 'lib/scrapetor/template_registry.rb', line 20 def size @plans.size end |
#store(fingerprint, plan) ⇒ Object
12 13 14 |
# File 'lib/scrapetor/template_registry.rb', line 12 def store(fingerprint, plan) @plans[fingerprint] = plan end |