Module: CocinaDisplay::Concerns::Druid

Included in:
CocinaDisplay::CocinaRecord
Defined in:
lib/cocina_display/concerns/druid.rb

Overview

Methods for extracting and formatting identifiers from Cocina records.

Instance Method Summary collapse

Instance Method Details

#bare_druidString?

Note:

A RelatedResource may not have a DRUID.

The DRUID for the object, without the druid: prefix.

Examples:

record.bare_druid #=> "bb099mt5053"

Returns:

  • (String, nil)


19
20
21
# File 'lib/cocina_display/concerns/druid.rb', line 19

def bare_druid
  druid.delete_prefix("druid:")
end

#druidString?

Note:

A RelatedResource may not have a DRUID, but could have a purl URL.

The DRUID for the object, with the druid: prefix.

Examples:

record.druid #=> "druid:bb099mt5053"

Returns:

  • (String, nil)


10
11
12
# File 'lib/cocina_display/concerns/druid.rb', line 10

def druid
  cocina_doc["externalIdentifier"]
end