Class: Pubid::Iala::Identifiers::Annex

Inherits:
Base
  • Object
show all
Defined in:
lib/pubid/iala/identifiers/annex.rb

Overview

IALA Annex to a base publication. Two surface forms appear in the corpus, both wrapping a Guideline:

"G1045 Annex Ed 1"           — bare Annex, no letter
"G1128 ANNEX A Ed 1.6"        — uppercase + letter (A/B/C/D)

The case of the marker is preserved (Annex vs ANNEX) for round-trip fidelity. Edition and language apply to the Annex itself, not the base.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.typeObject



31
32
33
# File 'lib/pubid/iala/identifiers/annex.rb', line 31

def self.type
  { key: :annex, title: "Annex", short: nil }
end

Instance Method Details

#base_identifier_from_kv(model, value) ⇒ Object



49
50
51
52
53
# File 'lib/pubid/iala/identifiers/annex.rb', line 49

def base_identifier_from_kv(model, value)
  return unless value

  model.base_identifier = ::Pubid::Iala::Identifier.from_hash(value)
end

#base_identifier_to_kv(model, doc) ⇒ Object

Public because lutaml-model invokes the to: / from: mapping methods via public_send during (de)serialization — a private section here raises NoMethodError on to_hash (matches the public visibility of Oiml::SupplementIdentifier's identical helpers).



39
40
41
42
43
44
45
46
47
# File 'lib/pubid/iala/identifiers/annex.rb', line 39

def base_identifier_to_kv(model, doc)
  base = model.base_identifier
  return unless base

  doc.add_child(
    Lutaml::KeyValue::DataModel::Element.new("base_identifier",
                                             base.to_hash),
  )
end