Class: Omnizip::Parallel::ParallelExtractor::ExtractionWorker

Inherits:
Fractor::Worker
  • Object
show all
Defined in:
lib/omnizip/parallel/parallel_extractor.rb

Overview

Fractor Worker class for extraction

Instance Method Summary collapse

Instance Method Details

#process(work) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/omnizip/parallel/parallel_extractor.rb', line 49

def process(work)
  entry = work.entry
  archive_path = work.archive_path
  dest_dir = work.dest_dir

  # Read and decompress entry data
  data = read_entry_data(archive_path, entry)

  # Determine destination path
  dest_path = ::File.join(dest_dir, entry.name)

  # Return result
  Fractor::WorkResult.new(
    result: {
      entry_name: entry.name,
      dest_path: dest_path,
      data: data,
      directory: entry.directory?,
      unix_perms: safe_unix_perms(entry),
    },
    work: work,
  )
rescue StandardError => e
  Fractor::WorkResult.new(
    error: e,
    work: work,
  )
end