Module: ActiveFedora::Identifiable::ClassMethods

Defined in:
lib/active_fedora/identifiable.rb

Instance Method Summary collapse

Instance Method Details

#from_uri(uri, _) ⇒ Object

Provides the common interface for ActiveTriples::Identifiable



54
55
56
57
58
# File 'lib/active_fedora/identifiable.rb', line 54

def from_uri(uri, _)
  find(uri_to_id(uri))
rescue ActiveFedora::ObjectNotFoundError, Ldp::Gone
  ActiveTriples::Resource.new(uri)
end

#id_to_uri(id) ⇒ Object

Transforms an id into a uri if translate_id_to_uri is set it uses that proc, otherwise just the default



41
42
43
# File 'lib/active_fedora/identifiable.rb', line 41

def id_to_uri(id)
  translate_id_to_uri.call(id)
end

#uri_to_id(uri) ⇒ Object

Transforms a uri into an id if translate_uri_to_id is set it uses that proc, otherwise just the default



48
49
50
# File 'lib/active_fedora/identifiable.rb', line 48

def uri_to_id(uri)
  translate_uri_to_id.call(uri)
end