Sha256: f07cf7d1416366479ce3284295229681a5cf5615a391f25b074dcd89fe51f07d
Contents?: true
Size: 641 Bytes
Versions: 39
Compression:
Stored size: 641 Bytes
Contents
# frozen_string_literal: true module Cocina module Models module Mapping # Utility methods for generating purl links class Purl class_attribute :base_url, default: 'https://purl.stanford.edu' def self.for(druid:) return nil if druid.nil? "#{base_url}/#{druid.delete_prefix('druid:')}" end def self.purl?(node) node.start_with?("https://#{host}") || node.start_with?("http://#{host}") end # the purl without the protocol part def self.host @host ||= base_url.sub(%r{^https?://}, '') end end end end end
Version data entries
39 entries across 39 versions & 1 rubygems