Module: Sufia::IdService

Defined in:
lib/sufia/id_service.rb

Class Method Summary collapse

Class Method Details

.mintObject



28
29
30
31
32
33
34
35
# File 'lib/sufia/id_service.rb', line 28

def self.mint
  @semaphore.synchronize do
    while true
      pid = self.next_id
      return pid unless ActiveFedora::Base.exists?(pid)
    end
  end
end

.valid?(identifier) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
# File 'lib/sufia/id_service.rb', line 23

def self.valid?(identifier)
  # remove the fedora namespace since it's not part of the noid
  noid = identifier.split(":").last
  return @minter.valid? noid
end