lib/importer/cylinder.rb
# Array of MARC record files to import.
Array of MARC record files to import.
Array of MARC record files to import .
def run
    logger.info "Starting ingest with options #{options.inspect}"
    abort_import unless @collection
    marcs = parse_marc_files(metadata_files)
    cylinders = marcs.length
    if options[:skip] && options[:skip] >= cylinders
      raise ArgumentError,
            "Number of records skipped (#{options[:skip]}) "\
            "greater than total records to ingest"
    end
    logger.debug "Audio files directories:"
    files_dirs.each { |d| logger.debug d }
    marcs.each_with_index do |record, count|
      next if options[:skip] && options[:skip] > count
      break if options[:number] && options[:number] <= imported_records_count
      if record["024"].blank? || record["024"]["a"].blank?
        logger.info "Skipping record #{count + 1}: No ARK found"
        next
      end
      logger.debug "Object attributes for item #{count + 1}:"
      logger.debug record.class
      logger.debug record
      indexer.writer.put attributes(record, indexer)
      @imported_records_count += 1
      logger.info "Queued record #{count + 1} of #{cylinders}."
    end 
  ensure
    indexer.writer.close if indexer&.writer
  end
def run logger . info "Starting ingest with options #{options.inspect}" abort_import unless @collection marcs = parse_marc_files ( metadata_files ) cylinders = marcs . length if options [ :skip ] && options [ :skip ] >= cylinders raise ArgumentError , "Number of records skipped (#{options[:skip]}) " "greater than total records to ingest" end logger . debug "Audio files directories:" files_dirs . each { | d | logger . debug d } marcs . each_with_index do | record , count | next if options [ :skip ] && options [ :skip ] > count break if options [ :number ] && options [ :number ] <= imported_records_count if record [ "024" ] . blank? || record [ "024" ] [ "a" ] . blank? logger . info "Skipping record #{count + 1}: No ARK found" next end logger . debug "Object attributes for item #{count + 1}:" logger . debug record . class logger . debug record indexer . writer . put attributes ( record , indexer ) @imported_records_count += 1 logger . info "Queued record #{count + 1} of #{cylinders}." end ensure indexer . writer . close if indexer &. writer end
Array of MARC record files to import.
Array of MARC record files to import .
# marcs.each_with_index