Class: CocinaDisplay::Events::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/cocina_display/events/location.rb

Overview

A single location represented in a Cocina event, like a publication place.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cocina) ⇒ Location

Initialize a Location object with Cocina structured data.

Parameters:

  • cocina (Hash)

    The Cocina structured data for the location.



11
12
13
# File 'lib/cocina_display/events/location.rb', line 11

def initialize(cocina)
  @cocina = cocina
end

Instance Attribute Details

#cocinaObject (readonly)

Returns the value of attribute cocina.



7
8
9
# File 'lib/cocina_display/events/location.rb', line 7

def cocina
  @cocina
end

Instance Method Details

#display_strString?

The name of the location. Decodes a MARC country code if present and no value was present.

Returns:

  • (String, nil)


18
19
20
# File 'lib/cocina_display/events/location.rb', line 18

def display_str
  cocina["value"] || decoded_country
end

#unencoded_value?Boolean

Is there an unencoded value (name) for this location?

Returns:

  • (Boolean)


24
25
26
# File 'lib/cocina_display/events/location.rb', line 24

def unencoded_value?
  cocina["value"].present?
end