Class: CocinaDisplay::Description::Access
- Inherits:
-
Object
- Object
- CocinaDisplay::Description::Access
- Defined in:
- lib/cocina_display/description/access.rb
Overview
Access information for a Cocina object.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cocina ⇒ Object
readonly
Returns the value of attribute cocina.
Instance Method Summary collapse
-
#contact_email? ⇒ Boolean
Whether the access info is a contact email.
-
#initialize(cocina) ⇒ Access
constructor
Create an Access object from Cocina structured data.
-
#label ⇒ String
The display label for the access metadata.
-
#to_s ⇒ String?
String representation of the access metadata.
-
#type ⇒ String?
The type of the access metadata, e.g.
Constructor Details
#initialize(cocina) ⇒ Access
Create an Access object from Cocina structured data.
9 10 11 |
# File 'lib/cocina_display/description/access.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/description/access.rb', line 5 def cocina @cocina end |
Instance Method Details
#contact_email? ⇒ Boolean
Whether the access info is a contact email. Always false, see CocinaDisplay::Description::AccessContact for cases when this is true
36 37 38 |
# File 'lib/cocina_display/description/access.rb', line 36 def contact_email? false end |
#label ⇒ String
The display label for the access metadata.
27 28 29 30 |
# File 'lib/cocina_display/description/access.rb', line 27 def label cocina["displayLabel"].presence || I18n.t(type&.parameterize&.underscore, default: :access, scope: "cocina_display.field_label.access") end |
#to_s ⇒ String?
String representation of the access metadata.
15 16 17 |
# File 'lib/cocina_display/description/access.rb', line 15 def to_s cocina["value"].presence end |
#type ⇒ String?
The type of the access metadata, e.g. “repository”.
21 22 23 |
# File 'lib/cocina_display/description/access.rb', line 21 def type cocina["type"].presence end |