module Researchmap2bib::UniqueId

Public Instance Methods

unique_id(key) click to toggle source
# File lib/researchmap2bib/unique_id.rb, line 6
def unique_id(key)
  if @@id_to_entry[key]
    i = 2
    begin
      new_key = key + ':' + i.to_s
      i += 1
    end while @@id_to_entry[new_key]
    @@id_to_entry[new_key] = true
    return new_key
  else
    @@id_to_entry[key] = true
    return key
  end
end