Module: Macros::Stanford

Defined in:
lib/macros/stanford.rb

Overview

Macros for extracting Stanford Specific MODS values from Nokogiri documents

Constant Summary collapse

NS =
{ mods: 'http://www.loc.gov/mods/v3',
rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
dc: 'http://purl.org/dc/elements/1.1/' }.freeze

Instance Method Summary collapse

Instance Method Details

#generate_sul_shown_at(record, druid) ⇒ Object

This is a URL for the Digital Object in its information context


14
15
16
17
18
19
20
21
# File 'lib/macros/stanford.rb', line 14

def generate_sul_shown_at(record, druid)
  mods_url = record.xpath('/*/mods:location/mods:url', NS).map(&:text)
  if druid.present?
    "https://purl.stanford.edu/#{druid}"
  elsif mods_url.present?
    mods_url.first
  end
end