Module: ActiveFedora::Rdf::Configurable
- Extended by:
- Deprecation
- Defined in:
- lib/active_fedora/rdf/configurable.rb
Overview
Module to include configurable class-wide properties common to Resource and RDFDatastream. It does its work at the class level, and is meant to be extended.
Define properties at the class level with:
configure base_uri: "http://oregondigital.org/resource/", repository: :parent
Available properties are base_uri, rdf_label, type, and repository
Instance Method Summary collapse
- #base_uri ⇒ Object
-
#configure(options = {}) ⇒ Object
API method for configuring class properties an RDF Resource may need.
- #rdf_label ⇒ Object
- #rdf_type(value) ⇒ Object
- #repository ⇒ Object
- #transform_type(value) ⇒ Object
- #type ⇒ Object
Instance Method Details
#base_uri ⇒ Object
14 15 16 |
# File 'lib/active_fedora/rdf/configurable.rb', line 14 def base_uri nil end |
#configure(options = {}) ⇒ Object
API method for configuring class properties an RDF Resource may need. This is an alternative to overriding the methods extended with this module.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/active_fedora/rdf/configurable.rb', line 37 def configure( = {}) { base_uri: [:base_uri], rdf_label: [:rdf_label], type: [:type], repository: [:repository] }.each do |name, value| if value value = self.send("transform_#{name}", value) if self.respond_to?("transform_#{name}") define_singleton_method(name) do value end end end end |
#rdf_label ⇒ Object
18 19 20 |
# File 'lib/active_fedora/rdf/configurable.rb', line 18 def rdf_label nil end |
#rdf_type(value) ⇒ Object
26 27 28 29 |
# File 'lib/active_fedora/rdf/configurable.rb', line 26 def rdf_type(value) Deprecation.warn Configurable, "rdf_type is deprecated and will be removed in active-fedora 8.0.0. Use configure type: instead.", caller configure type: value end |
#repository ⇒ Object
31 32 33 |
# File 'lib/active_fedora/rdf/configurable.rb', line 31 def repository :parent end |
#transform_type(value) ⇒ Object
53 54 55 56 57 |
# File 'lib/active_fedora/rdf/configurable.rb', line 53 def transform_type(value) RDF::URI.new(value).tap do |value| Resource.type_registry[value] = self end end |
#type ⇒ Object
22 23 24 |
# File 'lib/active_fedora/rdf/configurable.rb', line 22 def type nil end |