Module: Shared::Dwc::MediaIdentifier

Extended by:
ActiveSupport::Concern
Included in:
MediaExtensions
Defined in:
app/models/concerns/shared/dwc/media_identifier.rb

Overview

Shared logic for media identifier generation in both Ruby and SQL contexts. Used by Image and Sound models to generate Darwin Core media identifiers.

Constant Summary collapse

NAMESPACE_BY_CLASS =

Maps model class names to their namespace prefixes

{
  'Image' => 'image',
  'Sound' => 'sound'
}.freeze
PREFERRED_IDENTIFIER_TYPES =

Preferred identifier types in order of preference uuid takes precedence over uri, which takes precedence over id

{
  uuid: 'Identifier::Global::Uuid',
  uri:  'Identifier::Global::Uri'
}.freeze

Instance Method Summary collapse

Instance Method Details

#dwc_media_identifierObject

Instance method: delegates to class helper Images and sounds are unlikely to have a uuid or uri, so namespace with class name (this field is supposed to be unique).



49
50
51
# File 'app/models/concerns/shared/dwc/media_identifier.rb', line 49

def dwc_media_identifier
  self.class.dwc_media_identifier_for(self)
end