Class: Pubid::Export::SchemeExporter

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

Overview

Strategy for flavors using Scheme with class-level identifiers method and def self.type / TYPED_STAGES patterns.

Covers: ISO, IEC, ASTM, ASHRAE, ASME, CCSDS, CIE, CSA, JIS, JCGM,

OIML, IDF, API, SAE, NIST, IEEE

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



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
43
44
# File 'lib/pubid/export/scheme_exporter.rb', line 11

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

  fixture_data = fixture_examples

  identifier_types = klasses.filter_map do |klass|
    info = extract_type_info(klass)
    stages = extract_typed_stages(klass)
    type_key = info[:key]&.to_s

    # Match fixture examples to this type
    examples = match_examples(fixture_data, type_key, klass)

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

  all_attrs = klasses.first ? extract_attributes(klasses.first) : []
  wrapper_types = extract_wrapper_types

  FlavorResult.new(
    flavor: flavor,
    identifier_types: identifier_types,
    wrapper_types: wrapper_types,
    attributes: all_attrs,
  )
end