Sha256: 136c46acf5af95dc90c78516f25ec1f4ad7f63b53f59cfc8850e117ebac5f379
Contents?: true
Size: 597 Bytes
Versions: 24
Compression:
Stored size: 597 Bytes
Contents
# frozen_string_literal: true module Dor # Utilties for manipulating druids class PidUtils PID_REGEX = /[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{2}[0-9]{4}/.freeze # Since purl does not use the druid: prefix but much of dor does, use this function to strip the druid: if needed # @return [String] the druid sans the druid: or if there was no druid: prefix, the entire string you passed def self.remove_druid_prefix(druid) result = druid.match(PID_REGEX) result.nil? ? druid : result[0] # if no matches, return the string passed in, otherwise return the match end end end
Version data entries
24 entries across 24 versions & 1 rubygems