Class: Hyrax::Ingest::Runner

Inherits:
Object
  • Object
show all
Includes:
HasDepositor, HasIteration, HasLogger, HasReport, HasSIP, HasSharedSIP, Reporting, Interloper
Defined in:
lib/hyrax/ingest/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasDepositor

included

Methods included from HasLogger

config, #logger, #logger=

Methods included from HasReport

#report, #report=

Methods included from HasIteration

#iteration, #iteration=

Methods included from HasSharedSIP

#shared_sip, #shared_sip=

Methods included from HasSIP

#sip, #sip=

Methods included from Reporting

config

Constructor Details

#initialize(config_file_path:, sip_path: nil, shared_sip_path: nil, iteration: 0, depositor: nil) ⇒ Runner

Returns a new instance of Runner.



40
41
42
43
44
45
46
# File 'lib/hyrax/ingest/runner.rb', line 40

def initialize(config_file_path:, sip_path: nil, shared_sip_path: nil, iteration: 0, depositor: nil)
  self.sip = SIP.new(path: sip_path) if sip_path
  self.shared_sip = shared_sip_path != nil ? SIP.new(path: shared_sip_path) : nil
  self.iteration = iteration.to_i
  self.depositor = depositor
  @config = Hyrax::Ingest::Configuration.new(config_file_path: config_file_path)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



24
25
26
# File 'lib/hyrax/ingest/runner.rb', line 24

def config
  @config
end

Instance Method Details

#ingested_ids_by_typeObject

TODO: Does not yet return IDs of associated objects that were ingested as assocaited objects (i.e. objects that are nested under other objects in the ingest configuration). It only returns IDs for objects that are ingested per the top-level of ingest configuration.



56
57
58
59
60
61
62
63
64
65
# File 'lib/hyrax/ingest/runner.rb', line 56

def ingested_ids_by_type
  {}.tap do |h|
    ingesters.each do |ingester|
      if ingester.respond_to? :af_model
        h[ingester.af_model.class] ||= []
        h[ingester.af_model.class] << ingester.af_model.id
      end
    end
  end
end

#run!Object



48
49
50
# File 'lib/hyrax/ingest/runner.rb', line 48

def run!
  ingesters.collect { |ingester| ingester.run! }
end