Class: Scrapetor::TemplateRegistry

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeTemplateRegistry

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

#sizeObject



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