Method: Pubid::Core::Identifier::Base.update_old_code

Defined in:
lib/pubid/core/identifier/base.rb

.update_old_code(code) ⇒ Object



275
276
277
278
279
280
281
282
# File 'lib/pubid/core/identifier/base.rb', line 275

def update_old_code(code)
  return code unless get_update_codes

  get_update_codes.each do |from, to|
    code = code.gsub(from.match?(/^\/.*\/$/) ? Regexp.new(from[1..-2]) : /^#{Regexp.escape(from)}$/, to)
  end
  code
end