Class: Pubid::Export::RegistryExporter
- Inherits:
-
FlavorExporter
- Object
- FlavorExporter
- Pubid::Export::RegistryExporter
- Defined in:
- lib/pubid/export/registry_exporter.rb
Overview
Strategy for flavors using TYPED_STAGES_REGISTRY on the Scheme class (BSI, CEN). These don’t use per-class TYPED_STAGES but instead have a centralized registry mapping type_code → typed stages.
Constant Summary
Constants inherited from FlavorExporter
FlavorExporter::WRAPPER_CLASSES
Instance Attribute Summary
Attributes inherited from FlavorExporter
Instance Method Summary collapse
Methods inherited from FlavorExporter
Constructor Details
This class inherits a constructor from Pubid::Export::FlavorExporter
Instance Method Details
#export ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/pubid/export/registry_exporter.rb', line 11 def export registry = extract_registry return nil if registry.empty? known_website_keys = Set.new identifier_types = registry.group_by(&:type_code).map do |type_code, stages| wkey = resolve_website_key(type_code).to_s known_website_keys << wkey primary = stages.first IdentifierTypeResult.new( key: wkey, title: primary.name, short: nil, abbr: primary.abbr, typed_stages: stages, examples: [], ) end # Supplement with typed classes not in the registry additional = discover_additional_from_identifiers(known_website_keys) identifier_types.concat(additional) FlavorResult.new( flavor: flavor, identifier_types: identifier_types, wrapper_types: extract_wrapper_types, attributes: [], ) end |