Class: FedoraMigrate::Mover
- Inherits:
-
Object
- Object
- FedoraMigrate::Mover
- Includes:
- Hooks, MigrationOptions
- Defined in:
- lib/fedora_migrate/mover.rb
Direct Known Subclasses
ContentMover, DatastreamMover, DatesMover, ObjectMover, PermissionsMover, RDFDatastreamMover, RelsExtDatastreamMover
Instance Attribute Summary collapse
-
#report ⇒ Object
Returns the value of attribute report.
-
#source ⇒ Object
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
Attributes included from MigrationOptions
Class Method Summary collapse
Instance Method Summary collapse
- #id_component(object = nil) ⇒ Object
-
#initialize(*args) ⇒ Mover
constructor
A new instance of Mover.
- #migrate ⇒ Object
- #post_initialize ⇒ Object
- #results_report ⇒ Object
- #save ⇒ Object
- #target_errors ⇒ Object
Methods included from Hooks
#after_datastream_migration, #after_object_migration, #after_rdf_datastream_migration, #before_datastream_migration, #before_object_migration, #before_rdf_datastream_migration
Methods included from MigrationOptions
#application_creates_versions?, #blacklist, #conversion_options, #forced?, #not_forced?
Constructor Details
#initialize(*args) ⇒ Mover
Returns a new instance of Mover.
8 9 10 11 12 13 14 |
# File 'lib/fedora_migrate/mover.rb', line 8 def initialize(*args) @source = args[0] @target = args[1] = args[2] @report = results_report post_initialize end |
Instance Attribute Details
#report ⇒ Object
Returns the value of attribute report.
6 7 8 |
# File 'lib/fedora_migrate/mover.rb', line 6 def report @report end |
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/fedora_migrate/mover.rb', line 6 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
6 7 8 |
# File 'lib/fedora_migrate/mover.rb', line 6 def target @target end |
Class Method Details
.id_component(object) ⇒ Object
45 46 47 48 49 |
# File 'lib/fedora_migrate/mover.rb', line 45 def self.id_component(object) return object.pid.split(/:/).last if object.is_a?(Rubydora::DigitalObject) return object.to_s.split(/:/).last if object.respond_to?(:to_s) nil end |
Instance Method Details
#id_component(object = nil) ⇒ Object
39 40 41 42 43 |
# File 'lib/fedora_migrate/mover.rb', line 39 def id_component(object = nil) object ||= source raise FedoraMigrate::Errors::MigrationError, "can't get the id component without an object" if object.nil? self.class.id_component(object) end |
#migrate ⇒ Object
23 24 25 |
# File 'lib/fedora_migrate/mover.rb', line 23 def migrate report end |
#post_initialize ⇒ Object
16 17 |
# File 'lib/fedora_migrate/mover.rb', line 16 def post_initialize end |
#results_report ⇒ Object
19 20 21 |
# File 'lib/fedora_migrate/mover.rb', line 19 def results_report [] end |
#save ⇒ Object
27 28 29 |
# File 'lib/fedora_migrate/mover.rb', line 27 def save raise FedoraMigrate::Errors::MigrationError, "Failed to save target: #{target_errors}" unless target.save end |
#target_errors ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/fedora_migrate/mover.rb', line 31 def target_errors if target.respond_to?(:errors) target.errors..join(" -- ") else target.inspect end end |