Class: Pubid::Export::DataClassExporter
- Inherits:
-
FlavorExporter
- Object
- FlavorExporter
- Pubid::Export::DataClassExporter
- Defined in:
- lib/pubid/export/data_class_exporter.rb
Overview
Strategy for flavors using Lutaml::Model::Serializable as their Scheme (ETSI, Plateau). These have identifier classes in the Identifiers module that may not have def self.type.
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 |
# File 'lib/pubid/export/data_class_exporter.rb', line 9 def export klasses = resolve_identifier_classes_from_module return nil if klasses.empty? fixture_data = fixture_examples identifier_types = klasses.map do |klass| info = extract_type_info(klass) type_key = info[:key] examples = fixture_data[type_key] || fixture_data[type_key.to_s] || [] IdentifierTypeResult.new( key: info[:key], title: info[:title], short: info[:short], abbr: info[:abbr], typed_stages: [], examples: examples, ) end scheme = scheme_class attrs = scheme&.methods&.include?(:attributes) ? scheme.attributes.keys.map(&:to_s) : [] FlavorResult.new( flavor: flavor, identifier_types: identifier_types, attributes: attrs, ) end |