Class: Pubid::Idf::SupplementIdentifier

Inherits:
Identifier show all
Defined in:
lib/pubid/idf/supplement_identifier.rb

Overview

Base class for supplement identifiers (amendments, corrigenda).

This class provides common attributes and behavior for all supplement identifier types. Supplements wrap a base identifier and add additional information like amendment/corrigendum number and date.

Supplement identifiers should inherit from this class, not from SingleIdentifier (which is for base documents only).

Architecture Note:

  • Supplements have a base_identifier attribute (recursive structure)

  • Supplements share the to_s rendering pattern

  • Supplements inherit typed_stage from base Identifier class

Instance Method Summary collapse

Methods inherited from Identifier

#language_portion, #number_portion, parse, #publisher_portion

Methods inherited from Pubid::Identifier

#base_identifier, #eql?, #exclude, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, #render, #resolve_urn_generator, #root, #to_mr_string, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code

Constructor Details

This class inherits a constructor from Pubid::Identifier

Instance Method Details

#to_s(lang: :en, lang_single: false, with_edition: false) ⇒ String

Render supplement identifier as string.

Format: “base_identifier/ABBREVIATION number:year” Example: “IDF 125:1988/AMD 1:2023”

Parameters:

  • lang (Symbol) (defaults to: :en)

    Language (default: :en)

  • lang_single (Boolean) (defaults to: false)

    Use single-char language codes (default: false)

  • with_edition (Boolean) (defaults to: false)

    Include edition (default: false)

Returns:

  • (String)

    String representation of supplement



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/pubid/idf/supplement_identifier.rb', line 30

def to_s(lang: :en, lang_single: false, with_edition: false)
  [
    base_identifier.to_s(lang: lang, lang_single: lang_single,
                         with_edition: with_edition),
    "/",
    typed_stage.abbreviation,
    " ",
    number.value,
    (date ? ":#{date.year}" : ""),
  ].join
end