Module: ActiveFedora::FedoraAttributes
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/active_fedora/fedora_attributes.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #id ⇒ Object
- #id=(id) ⇒ Object
-
#pid ⇒ Object
TODO: Remove after we no longer support #pid.
-
#resource ⇒ Object
The resource is the RdfResource object that stores the graph for the datastream and is the central point for its relationship to other nodes.
-
#set_value(*args) ⇒ Object
Override ActiveTriples method for setting properties.
- #uri ⇒ Object
Instance Method Details
#id ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/active_fedora/fedora_attributes.rb', line 29 def id if uri.kind_of?(::RDF::URI) && uri.value.blank? nil elsif uri.present? self.class.uri_to_id(URI.parse(uri)) end end |
#id=(id) ⇒ Object
37 38 39 40 |
# File 'lib/active_fedora/fedora_attributes.rb', line 37 def id=(id) raise "ID has already been set to #{self.id}" if self.id @ldp_source = build_ldp_resource(id.to_s) end |
#pid ⇒ Object
TODO: Remove after we no longer support #pid.
44 45 46 47 |
# File 'lib/active_fedora/fedora_attributes.rb', line 44 def pid Deprecation.warn FedoraAttributes, "#{self.class}#pid is deprecated and will be removed in active-fedora 10.0. Use #{self.class}#id instead." id end |
#resource ⇒ Object
The resource is the RdfResource object that stores the graph for the datastream and is the central point for its relationship to other nodes.
set_value, get_value, and property accessors are delegated to this object.
61 62 63 |
# File 'lib/active_fedora/fedora_attributes.rb', line 61 def resource @resource ||= self.class.resource_class.new(@ldp_source.graph.rdf_subject, @ldp_source.graph) end |
#set_value(*args) ⇒ Object
Override ActiveTriples method for setting properties
24 25 26 27 |
# File 'lib/active_fedora/fedora_attributes.rb', line 24 def set_value(*args) raise ReadOnlyRecord if readonly? resource.set_value(*args) end |
#uri ⇒ Object
49 50 51 52 53 |
# File 'lib/active_fedora/fedora_attributes.rb', line 49 def uri # TODO could we return a RDF::URI instead? uri = @ldp_source.try(:subject_uri) uri.value == '' ? uri : uri.to_s end |