Class: CocinaDisplay::Titles::Title

Inherits:
Parallel::Parallel show all
Defined in:
lib/cocina_display/titles/title.rb

Overview

A Title represented by one or more TitleValues in various languages/scripts.

Instance Attribute Summary collapse

Attributes inherited from Parallel::Parallel

#cocina

Instance Method Summary collapse

Methods inherited from Parallel::Parallel

#has_translation?, #has_transliteration?, #has_vernacular?, #main_value, #own_type, #own_typed?, #parallel_values, #primary?, #status, #translated_value, #transliterated_value, #type, #typed?, #vernacular_value

Constructor Details

#initialize(cocina, part_label: nil, part_numbers: nil) ⇒ Title

Create a new Title object.

Parameters:

  • cocina (Hash)
  • part_label (String, nil) (defaults to: nil)

    part label for digital serials

  • part_numbers (Array<String>) (defaults to: nil)

    part numbers for related resources



16
17
18
19
20
# File 'lib/cocina_display/titles/title.rb', line 16

def initialize(cocina, part_label: nil, part_numbers: nil)
  super(cocina)
  @part_label = part_label
  @part_numbers = part_numbers
end

Instance Attribute Details

#part_labelObject (readonly)

Part data for digital serials, coming from elsewhere in the Cocina.



6
7
8
# File 'lib/cocina_display/titles/title.rb', line 6

def part_label
  @part_label
end

#part_numbersObject (readonly)

Part data for digital serials, coming from elsewhere in the Cocina.



6
7
8
# File 'lib/cocina_display/titles/title.rb', line 6

def part_numbers
  @part_numbers
end

Instance Method Details

#labelString

Label used when displaying the title.

Returns:

  • (String)


24
25
26
# File 'lib/cocina_display/titles/title.rb', line 24

def label
  display_label || type_label
end

#to_sString?

The string representation of the title, for display.

Returns:

  • (String, nil)


30
31
32
# File 'lib/cocina_display/titles/title.rb', line 30

def to_s
  display_title
end