Module: ActiveFedora::Identifiable

Extended by:
ActiveSupport::Concern
Included in:
Base, File
Defined in:
lib/active_fedora/identifiable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#idObject



19
20
21
22
23
24
25
# File 'lib/active_fedora/identifiable.rb', line 19

def id
  if uri.is_a?(::RDF::URI) && uri.value.blank?
    nil
  elsif uri.present?
    self.class.uri_to_id(URI.parse(uri))
  end
end

#id=(id) ⇒ Object



27
28
29
30
# File 'lib/active_fedora/identifiable.rb', line 27

def id=(id)
  raise "ID has already been set to #{self.id}" if self.id
  @ldp_source = build_ldp_resource(id.to_s)
end

#uriRDF::URI

Returns the uri for this resource.

Returns:

  • (RDF::URI)

    the uri for this resource



33
34
35
# File 'lib/active_fedora/identifiable.rb', line 33

def uri
  @ldp_source.subject_uri
end