Class: Pubid::Export::IeeeExporter

Inherits:
FlavorExporter show all
Defined in:
lib/pubid/export/ieee_exporter.rb

Overview

Strategy for IEEE, which has identifier classes in the Identifiers module without a Scheme.identifiers method.

Constant Summary

Constants inherited from FlavorExporter

FlavorExporter::WRAPPER_CLASSES

Instance Attribute Summary

Attributes inherited from FlavorExporter

#flavor

Instance Method Summary collapse

Methods inherited from FlavorExporter

#initialize

Constructor Details

This class inherits a constructor from Pubid::Export::FlavorExporter

Instance Method Details

#exportObject



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
# File 'lib/pubid/export/ieee_exporter.rb', line 10

def export
  klasses = resolve_ieee_identifiers
  return nil if klasses.empty?

  fixture_data = fixture_examples
  seen_keys = Set.new

  identifier_types = klasses.filter_map do |klass|
    info = extract_type_info(klass)
    next if seen_keys.include?(info[:key])

    seen_keys << info[:key]

    type_key = info[:key]
    examples = match_ieee_examples(fixture_data, type_key, klass)

    IdentifierTypeResult.new(
      key: info[:key],
      title: info[:title],
      short: info[:short],
      abbr: info[:abbr],
      typed_stages: [],
      examples: examples,
    )
  end

  FlavorResult.new(
    flavor: flavor,
    identifier_types: identifier_types,
    attributes: [],
  )
end