Class: Hyrax::Ingest::Ingester::ActiveFedoraPropertyAssigner
- Inherits:
-
Object
- Object
- Hyrax::Ingest::Ingester::ActiveFedoraPropertyAssigner
- Defined in:
- lib/hyrax/ingest/ingester/active_fedora_property_assigner.rb
Instance Attribute Summary collapse
-
#af_model ⇒ Object
readonly
Returns the value of attribute af_model.
-
#fetcher ⇒ Object
readonly
Returns the value of attribute fetcher.
-
#rdf_predicate ⇒ Object
readonly
Returns the value of attribute rdf_predicate.
-
#transformer ⇒ Object
readonly
Returns the value of attribute transformer.
Instance Method Summary collapse
- #assign! ⇒ Object
-
#initialize(options = {}) ⇒ ActiveFedoraPropertyAssigner
constructor
A new instance of ActiveFedoraPropertyAssigner.
Methods included from HasLogger
Methods included from HasReport
Constructor Details
#initialize(options = {}) ⇒ ActiveFedoraPropertyAssigner
Returns a new instance of ActiveFedoraPropertyAssigner.
21 22 23 24 25 26 27 28 |
# File 'lib/hyrax/ingest/ingester/active_fedora_property_assigner.rb', line 21 def initialize(={}) @rdf_predicate = [:rdf_predicate] @fetcher = [:fetcher] @af_model = [:af_model] @transformer = [:transformer] raise Hyrax::Ingest::Errors::UnknownActiveFedoraModel.new(@af_model.class) unless @af_model.is_a? ActiveFedora::Base raise Hyrax::Ingest::Errors::InvalidFetcher.new(@fetcher.class) unless @fetcher.is_a? Hyrax::Ingest::Fetcher::Base end |
Instance Attribute Details
#af_model ⇒ Object (readonly)
Returns the value of attribute af_model.
19 20 21 |
# File 'lib/hyrax/ingest/ingester/active_fedora_property_assigner.rb', line 19 def af_model @af_model end |
#fetcher ⇒ Object (readonly)
Returns the value of attribute fetcher.
19 20 21 |
# File 'lib/hyrax/ingest/ingester/active_fedora_property_assigner.rb', line 19 def fetcher @fetcher end |
#rdf_predicate ⇒ Object (readonly)
Returns the value of attribute rdf_predicate.
19 20 21 |
# File 'lib/hyrax/ingest/ingester/active_fedora_property_assigner.rb', line 19 def rdf_predicate @rdf_predicate end |
#transformer ⇒ Object (readonly)
Returns the value of attribute transformer.
19 20 21 |
# File 'lib/hyrax/ingest/ingester/active_fedora_property_assigner.rb', line 19 def transformer @transformer end |
Instance Method Details
#assign! ⇒ Object
30 31 32 33 34 35 |
# File 'lib/hyrax/ingest/ingester/active_fedora_property_assigner.rb', line 30 def assign! af_model.set_value(property_name, fetched_and_transformed_value) rescue ::ActiveTriples::Relation::ValueError => e # Rethrow ActiveTriples::Relation::ValueError as something more specific to ingest. raise Hyrax::Ingest::Errors::InvalidActiveFedoraPropertyValue.new(fetched_value, property_name, rdf_predicate) end |