class Libis::Ingester::FormatIdentifier

Protected Instance Methods

collect_filepaths(item) click to toggle source
# File lib/libis/ingester/tasks/format_identifier.rb, line 50
def collect_filepaths(item)
  return File.absolute_path(item.fullpath) if item.is_a? Libis::Ingester::FileItem
  item.map do |subitem|
    collect_filepaths(subitem)
  end.flatten.compact
end
process(item) click to toggle source
# File lib/libis/ingester/tasks/format_identifier.rb, line 41
def process(item)
  file_list = collect_filepaths(item)
  format_list = Libis::Format::Identifier.get(file_list, parameter(:format_options).key_strings_to_symbols)
  process_messages(format_list, item)
  apply_formats(item, format_list[:formats])
rescue => e
  raise Libis::WorkflowAbort, "Error during Format identification: #{e.message} @ #{e.backtrace.first}"
end