lib/sufia/models/id_service.rb in sufia-models-0.0.2 vs lib/sufia/models/id_service.rb in sufia-models-0.1.0

- old
+ new

@@ -14,13 +14,14 @@ require 'noid' module Sufia module IdService - @minter = ::Noid::Minter.new(:template => '.reeddeeddk') + @template = Sufia.config.noid_template rescue '.reeddeeddk' + @minter = ::Noid::Minter.new(:template => @template) @pid = $$ - @namespace = Sufia::Engine.config.id_namespace + @namespace = Sufia.config.id_namespace @semaphore = Mutex.new def self.valid?(identifier) # remove the fedora namespace since it's not part of the noid noid = identifier.split(":").last return @minter.valid? noid @@ -39,10 +40,10 @@ def self.next_id pid = '' File.open("tmp/minter-state", File::RDWR|File::CREAT, 0644) {|f| f.flock(File::LOCK_EX) yaml = YAML::load(f.read) - yaml = {:template => '.reeddeeddk'} unless yaml + yaml = {:template => @template} unless yaml minter = ::Noid::Minter.new(yaml) pid = "#{@namespace}:#{minter.mint}" f.rewind yaml = YAML::dump(minter.dump) f.write yaml