Class: CocinaDisplay::Subjects::NameSubjectValue

Inherits:
SubjectValue
  • Object
show all
Defined in:
lib/cocina_display/subjects/subject_value.rb

Overview

A subject value representing a named entity.

Instance Attribute Summary collapse

Attributes inherited from SubjectValue

#cocina, #type

Instance Method Summary collapse

Methods inherited from SubjectValue

atomic_types, from_cocina

Constructor Details

#initialize(cocina) ⇒ NameSubjectValue

Initialize a NameSubjectValue object with Cocina structured data.

Parameters:

  • cocina (Hash)

    The Cocina structured data for the subject.



53
54
55
56
# File 'lib/cocina_display/subjects/subject_value.rb', line 53

def initialize(cocina)
  super
  @name = Contributors::Name.new(cocina)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



49
50
51
# File 'lib/cocina_display/subjects/subject_value.rb', line 49

def name
  @name
end

Instance Method Details

#display_strString

Use the contributor name formatting rules for display.

Returns:

  • (String)

    The formatted name string, including life dates

See Also:

  • Contributor::Name#display_str


61
62
63
# File 'lib/cocina_display/subjects/subject_value.rb', line 61

def display_str
  @name.display_str(with_date: true)
end