Class: Pubid::Export::NistExporter
- Inherits:
-
FlavorExporter
- Object
- FlavorExporter
- Pubid::Export::NistExporter
- Defined in:
- lib/pubid/export/nist_exporter.rb
Overview
Strategy for NIST, which has a unique identifier architecture: per-class typed_stages class method (not TYPED_STAGES constant), and a Scheme.identifiers class method.
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
9 10 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 42 |
# File 'lib/pubid/export/nist_exporter.rb', line 9 def export scheme = scheme_class return nil unless scheme klasses = scheme.identifiers.reject { |k| k == scheme_module::Identifiers::Base } fixture_data = fixture_examples seen_keys = Set.new identifier_types = klasses.filter_map do |klass| info = extract_type_info(klass) type_key = info[:key] next if seen_keys.include?(type_key) seen_keys << type_key examples = match_nist_examples(fixture_data, type_key, klass) stages = klass.typed_stages IdentifierTypeResult.new( key: info[:key], title: info[:title], short: info[:short], abbr: stages.flat_map(&:abbr), typed_stages: stages, examples: examples, ) end FlavorResult.new( flavor: flavor, identifier_types: identifier_types, attributes: klasses.first ? extract_attributes(klasses.first) : [], ) end |