Module: Dcc::Migrate
- Defined in:
- lib/dcc/migrate.rb
Class Method Summary collapse
Class Method Details
.call(dcc, from:, to:) ⇒ Dcc::V2::DigitalCalibrationCertificate, Dcc::V3::DigitalCalibrationCertificate
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dcc/migrate.rb', line 15 def call(dcc, from:, to:) from_major = ::Dcc::Schema::Version.major(from) to_major = ::Dcc::Schema::Version.major(to) if from_major == to_major # Same major: just rewrite the schemaVersion attribute. return rewrite_schema_version(dcc, to) end # Cross-major migration: serialize then re-parse under target. xml = dcc.to_xml target_parser = ::Dcc.parser_for(to_major) target_parser.load_all! migrated = target_parser.parse(xml) rewrite_schema_version(migrated, to) end |