Class: Pubid::Jcgm::SupplementIdentifier

Inherits:
SingleIdentifier show all
Defined in:
lib/pubid/jcgm/supplement_identifier.rb

Overview

Base class for JCGM supplement identifiers (amendments, corrigenda, etc.)

The supplement's OWN number (the "1" in "/Cor 1", the "2" in "/Amd 2") is stored in the inherited number attribute — NOT a separate iteration attribute. Each supplement is itself a numbered document, just like the base. The base document's number is accessed via base.number. This mirrors how pubid-Iso models supplements.

Instance Method Summary collapse

Methods inherited from SingleIdentifier

#build_code, #date_for, #day_from_kv, #day_to_kv, default_publisher, #emit_kv, #language_portion, #month_from_kv, #month_to_kv, #number_from_kv, #number_portion, #number_to_kv, published_typed_stage, #publisher_portion, #stage, #type, #year_from_kv, #year_to_kv

Methods inherited from Identifier

parse

Methods inherited from 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

Instance Method Details

#base_from_kv(model, value) ⇒ Object



39
40
41
42
43
# File 'lib/pubid/jcgm/supplement_identifier.rb', line 39

def base_from_kv(model, value)
  return unless value

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

#base_to_kv(model, doc) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/pubid/jcgm/supplement_identifier.rb', line 29

def base_to_kv(model, doc)
  return unless model.base

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

#publisherObject

Delegate publisher to base



46
47
48
# File 'lib/pubid/jcgm/supplement_identifier.rb', line 46

def publisher
  base&.publisher
end