Module: CocinaDisplay::Concerns::Titles
- Included in:
- CocinaDisplay::CocinaRecord
- Defined in:
- lib/cocina_display/concerns/titles.rb
Overview
Methods for finding and formatting titles.
Instance Method Summary collapse
-
#additional_titles ⇒ Array<String>
Any additional titles for the object excluding the main title.
-
#display_title ⇒ String
The full title, joined together with additional punctuation.
-
#full_title ⇒ String
The full title for the object, including subtitle, part name, etc.
-
#main_title ⇒ String
The main title for the object, without subtitle, part name, etc.
-
#sort_title ⇒ String
A string value for sorting by title that sorts missing values last.
Instance Method Details
#additional_titles ⇒ Array<String>
Any additional titles for the object excluding the main title.
36 37 38 |
# File 'lib/cocina_display/concerns/titles.rb', line 36 def additional_titles CocinaDisplay::TitleBuilder.additional_titles(cocina_titles) end |
#display_title ⇒ String
The full title, joined together with additional punctuation. If there are multiple titles, uses the first.
29 30 31 |
# File 'lib/cocina_display/concerns/titles.rb', line 29 def display_title CocinaDisplay::TitleBuilder.build(cocina_titles, catalog_links: catalog_links) end |
#full_title ⇒ String
This corresponds to the entire MARC 245 field.
The full title for the object, including subtitle, part name, etc. If there are multiple titles, uses the first.
21 22 23 |
# File 'lib/cocina_display/concerns/titles.rb', line 21 def full_title CocinaDisplay::TitleBuilder.full_title(cocina_titles, catalog_links: catalog_links).first end |
#main_title ⇒ String
This corresponds to the “short title” in MODS XML, or MARC 245$a only.
The main title for the object, without subtitle, part name, etc. If there are multiple titles, uses the first.
12 13 14 |
# File 'lib/cocina_display/concerns/titles.rb', line 12 def main_title CocinaDisplay::TitleBuilder.main_title(cocina_titles).first end |
#sort_title ⇒ String
A string value for sorting by title that sorts missing values last. Ignores punctuation, leading/trailing spaces, and non-sorting characters.
44 45 46 |
# File 'lib/cocina_display/concerns/titles.rb', line 44 def sort_title CocinaDisplay::TitleBuilder.sort_title(cocina_titles, catalog_links: catalog_links).first || "\u{10FFFF}" end |