Class: Metanorma::IsoDocument::Metadata::IsoLocalizedTitle

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/metanorma/iso_document/metadata/iso_localized_title.rb

Overview

Title of ISO/IEC document for a single language. Groups all title parts (title_intro, title_main, title_part, etc.) for one language. This is the GroupClass used by TitleCollection’s consolidation mapping.

Instance Method Summary collapse

Instance Method Details

#to_sObject

Compose all parts into a single title string



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/metanorma/iso_document/metadata/iso_localized_title.rb', line 36

def to_s
  parts = []
  parts << title_intro&.value if title_intro
  parts << title_main&.value if title_main
  parts << title_full&.value if title_full && !title_main
  if title_part
    prefix = title_part_prefix&.value.to_s.strip
    part_val = title_part.value
    if !prefix.empty?
      sep = prefix.end_with?(":") ? " " : ": "
      parts << "#{prefix}#{sep}#{part_val}"
    else
      parts << part_val
    end
  end
  return parts.join(" — ") unless parts.empty?
  ""
end