class FedoraMigrate::Mover

Attributes

report[RW]
source[RW]
target[RW]

Public Class Methods

id_component(object) click to toggle source
# 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
new(*args) click to toggle source
# File lib/fedora_migrate/mover.rb, line 8
def initialize(*args)
  @source = args[0]
  @target = args[1]
  @options = args[2]
  @report = results_report
  post_initialize
end

Public Instance Methods

id_component(object = nil) click to toggle source
# 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() click to toggle source
# File lib/fedora_migrate/mover.rb, line 23
def migrate
  report
end
post_initialize() click to toggle source
# File lib/fedora_migrate/mover.rb, line 16
def post_initialize
end
results_report() click to toggle source
# File lib/fedora_migrate/mover.rb, line 19
def results_report
  []
end
save() click to toggle source
# 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() click to toggle source
# File lib/fedora_migrate/mover.rb, line 31
def target_errors
  if target.respond_to?(:errors)
    target.errors.full_messages.join(" -- ")
  else
    target.inspect
  end
end