Class: Pubid::Cie::Identifiers::Bundle
- Inherits:
-
SingleIdentifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::Cie::Identifier
- SingleIdentifier
- Pubid::Cie::Identifiers::Bundle
- Defined in:
- lib/pubid/cie/identifiers/bundle.rb
Overview
Bundle identifier for CIE: a comma-separated list of sibling documents, each a full CIE identifier (typically a Supplement). Example: CIE 198-SP1.1:2011,198-SP1.2:2011,198-SP1.3:2011,198-SP1.4:2011
A CIE bundle is the parts of one supplement of one standard, so its
members share a base document. That shared base is hoisted to the
bundle and the ids carry only what differs (supplement number/part);
#root walks base to the origin standard for the relaton-index key.
(Defensive: if members ever don't share a base, each id keeps its own
and base is nil — see Builder#build_bundle.)
Instance Method Summary collapse
-
#root ⇒ Object
The origin document: the shared base's root, else the first member's.
-
#to_s ⇒ Object
The printed form writes the publisher once: the first member keeps its "CIE " prefix, the rest are bare.
Methods inherited from SingleIdentifier
#date_sep_char, #exclude, #mr_languages, #mr_year
Methods inherited from Pubid::Cie::Identifier
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, #sibling_of?, #supplement_of?, #to_hash, #to_mr_string, #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
#root ⇒ Object
The origin document: the shared base's root, else the first member's.
23 24 25 |
# File 'lib/pubid/cie/identifiers/bundle.rb', line 23 def root (base || ids&.first)&.root || self end |
#to_s ⇒ Object
The printed form writes the publisher once: the first member keeps its "CIE " prefix, the rest are bare. A base-less member is re-based onto the bundle's shared base for rendering.
30 31 32 33 34 35 36 37 |
# File 'lib/pubid/cie/identifiers/bundle.rb', line 30 def to_s return "" unless ids&.any? ids.each_with_index.map do |id, i| member = id.base ? id : rebased(id) i.zero? ? member.to_s : member.to_s.delete_prefix("CIE ") end.join(",") end |