Class: CocinaDisplay::Events::Note
- Inherits:
-
Object
- Object
- CocinaDisplay::Events::Note
- Defined in:
- lib/cocina_display/events/note.rb
Overview
A single note represented in a Cocina event, like an issuance or edition note.
Instance Attribute Summary collapse
-
#cocina ⇒ Object
readonly
Returns the value of attribute cocina.
Instance Method Summary collapse
-
#initialize(cocina) ⇒ Note
constructor
Initialize a Note object with Cocina structured data.
-
#label ⇒ String
The display label for the note.
-
#to_s ⇒ String?
The value of the note.
-
#type ⇒ String?
The type of the note, like “issuance” or “edition”.
Constructor Details
#initialize(cocina) ⇒ Note
Initialize a Note object with Cocina structured data.
9 10 11 |
# File 'lib/cocina_display/events/note.rb', line 9 def initialize(cocina) @cocina = cocina end |
Instance Attribute Details
#cocina ⇒ Object (readonly)
Returns the value of attribute cocina.
5 6 7 |
# File 'lib/cocina_display/events/note.rb', line 5 def cocina @cocina end |
Instance Method Details
#label ⇒ String
The display label for the note.
27 28 29 30 |
# File 'lib/cocina_display/events/note.rb', line 27 def label cocina["displayLabel"].presence || I18n.t(type&.parameterize&.underscore, default: :default, scope: "cocina_display.field_label.event.note") end |
#to_s ⇒ String?
The value of the note.
15 16 17 |
# File 'lib/cocina_display/events/note.rb', line 15 def to_s cocina["value"].presence end |
#type ⇒ String?
The type of the note, like “issuance” or “edition”.
21 22 23 |
# File 'lib/cocina_display/events/note.rb', line 21 def type cocina["type"].presence end |