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



35
36
37
38
39
40
41
# File 'lib/active_fedora/identifiable.rb', line 35

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



43
44
45
46
# File 'lib/active_fedora/identifiable.rb', line 43

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



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

def uri
  @ldp_source.subject_uri
end