Class: ActiveFedora::Core::FedoraIdTranslator

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/core/fedora_id_translator.rb

Constant Summary collapse

SLASH =
'/'.freeze

Class Method Summary collapse

Class Method Details

.call(id) ⇒ Object



4
5
6
7
8
9
# File 'lib/active_fedora/core/fedora_id_translator.rb', line 4

def self.call(id)
  id = URI::DEFAULT_PARSER.escape(id, '[]'.freeze)
  id = "/#{id}" unless id.start_with? SLASH
  id = ActiveFedora.fedora.base_path + id unless ActiveFedora.fedora.base_path == SLASH || id.start_with?("#{ActiveFedora.fedora.base_path}/")
  ActiveFedora.fedora.host + id
end