Class: Pubid::Export::Exporter
- Inherits:
-
Object
- Object
- Pubid::Export::Exporter
- Defined in:
- lib/pubid/export/exporter.rb
Overview
Top-level orchestrator. Iterates flavors and delegates to FlavorExporter.
Open/Closed: Adding a new flavor only requires adding it to FLAVORS; no existing code changes.
Constant Summary collapse
- FLAVORS =
%i[ iso iec ieee nist bsi itu cen_cenelec etsi ansi astm ashrae asme ccsds cie csa jis jcgm oiml idf api amca plateau sae ].freeze
Class Method Summary collapse
-
.export_all ⇒ Hash{String => Hash}
Export all flavors to a hash suitable for JSON serialization.
Class Method Details
.export_all ⇒ Hash{String => Hash}
Export all flavors to a hash suitable for JSON serialization.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pubid/export/exporter.rb', line 17 def self.export_all require "pubid" FLAVORS.each_with_object({}) do |flavor, result| exporter = FlavorExporter.new(flavor) flavor_result = exporter.export next unless flavor_result result[flavor.to_s] = flavor_result.to_hash rescue StandardError => e warn "Export warning (#{flavor}): #{e.}" end end |