Class: Dor::PidUtils
- Inherits:
-
Object
- Object
- Dor::PidUtils
- Defined in:
- lib/dor/utils/pid_utils.rb
Overview
Utilties for manipulating druids
Constant Summary collapse
- PID_REGEX =
/[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{2}[0-9]{4}/.freeze
Class Method Summary collapse
-
.remove_druid_prefix(druid) ⇒ String
Since purl does not use the druid: prefix but much of dor does, use this function to strip the druid: if needed.
Class Method Details
.remove_druid_prefix(druid) ⇒ String
Since purl does not use the druid: prefix but much of dor does, use this function to strip the druid: if needed
9 10 11 12 |
# File 'lib/dor/utils/pid_utils.rb', line 9 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 |