Class: Pubid::Iso::SupplementIdentifier
- Inherits:
-
SingleIdentifier
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Identifier
- SingleIdentifier
- Pubid::Iso::SupplementIdentifier
- Defined in:
- lib/pubid/iso/supplement_identifier.rb
Direct Known Subclasses
Identifiers::Addendum, Identifiers::Amendment, Identifiers::Corrigendum, Identifiers::DirectivesSupplement, Identifiers::Extract, Identifiers::Supplement
Constant Summary
Constants inherited from Identifier
Instance Method Summary collapse
- #copublishers ⇒ Object
-
#mr_supplement_suffix ⇒ Object
MR supplement suffix:
/{type}.{number}.{year}(e.g. "/amd.1.2020"). -
#publisher ⇒ Object
A supplement carries the publisher/copublishers of the document it supplements.
- #to_s(**opts) ⇒ Object
Methods inherited from Identifier
#all_parts_from_kv, #all_parts_to_kv, #build_code, build_type_map, #copublishers_from_kv, #copublishers_to_kv, #date_for, #day_from_kv, #day_to_kv, default_publisher, #emit_code, #emit_date_part, #month_from_kv, #month_to_kv, #number_from_kv, #number_to_kv, parse, #part_from_kv, #part_to_kv, published_typed_stage, #publisher_for, #publisher_from_kv, #publisher_to_kv, #stage, #stage_from_kv, #stage_iteration_from_kv, #stage_iteration_to_kv, #stage_to_kv, #subpart_from_kv, #subpart_to_kv, #type, #undated_from_kv, #undated_to_kv, #with_harmonized_stage, #year_from_kv, #year_to_kv
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_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_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
#copublishers ⇒ Object
29 30 31 |
# File 'lib/pubid/iso/supplement_identifier.rb', line 29 def copublishers root.copublishers if base end |
#mr_supplement_suffix ⇒ Object
MR supplement suffix: /{type}.{number}.{year} (e.g. "/amd.1.2020").
The MrString renderer recurses into base and appends this so the
full supplement chain round-trips losslessly (issue #142).
42 43 44 45 46 47 48 49 50 |
# File 'lib/pubid/iso/supplement_identifier.rb', line 42 def mr_supplement_suffix segments = [] segments << mr_type if mr_type segments << number&.to_s if number segments << date&.year&.to_s if date&.year return nil if segments.empty? segments.join(".") end |
#publisher ⇒ Object
A supplement carries the publisher/copublishers of the document it
supplements. Delegate to the root rather than the immediate base so a
nested supplement (e.g. ".../Amd 1/Cor 1") reads identity from the
underlying standard in one hop, regardless of chain depth. This keeps a
parsed supplement and a from_hash-deserialized one in agreement (== and
index matching compare both). Guard on base: root returns
self when there is no base, which would otherwise recurse forever.
25 26 27 |
# File 'lib/pubid/iso/supplement_identifier.rb', line 25 def publisher root.publisher if base end |
#to_s(**opts) ⇒ Object
33 34 35 36 37 |
# File 'lib/pubid/iso/supplement_identifier.rb', line 33 def to_s(**opts) context = build_rendering_context(nil, format: :human, **opts) Pubid::Renderers::SupplementRenderer.new(self).render(context:, **opts.slice(:with_edition)) end |