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

Inherits:
Pubid::Iala::Identifier 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.

Constant Summary

Constants inherited from Pubid::Iala::Identifier

Pubid::Iala::Identifier::IALA_TYPE_MAP

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pubid::Iala::Identifier

parse, #to_urn, #type_letter

Methods inherited from Pubid::Identifier

apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, #exclude, from_hash, #has_supplement?, #hash, #includes?, #initialize, #matches?, #mr_all_parts, #mr_edition, #mr_languages, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_subpart, #mr_supplement_suffix, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #related_to?, #render, #resolve_urn_generator, #root, #sibling_of?, #supplement_of?, #to_hash, #to_mr_string, #to_s, #to_slug, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year

Constructor Details

This class inherits a constructor from Pubid::Identifier

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_from_kv(model, value) ⇒ Object



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

def base_from_kv(model, value)
  return unless value

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

#base_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_to_kv(model, doc)
  base = model.base
  return unless base

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