Class: Datafile::ZipWorker

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging
Defined in:
lib/datafile/workers/zip/worker.rb

Overview

check: rename to ZipDatafileWorker?? or ZipDatafile -why, why not ??

Instance Method Summary collapse

Constructor Details

#initialize(datafile) ⇒ ZipWorker

Returns a new instance of ZipWorker.


9
10
11
# File 'lib/datafile/workers/zip/worker.rb', line 9

def initialize( datafile )
  @datafile = datafile
end

Instance Method Details

#calcObject


30
31
32
33
34
# File 'lib/datafile/workers/zip/worker.rb', line 30

def calc
  @datafile.scripts.each do |script|
    script.call
  end
end

#downloadObject


13
14
15
16
17
# File 'lib/datafile/workers/zip/worker.rb', line 13

def download
  @datafile.datasets.each do |dataset|
    dataset.zip_worker.download
  end
end

#dumpObject


36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/datafile/workers/zip/worker.rb', line 36

def dump
  ## also dump inlines
  @datafile.inlines.each do |inline|
    inline.dump
  end
  @datafile.datasets.each do |dataset|
    dataset.zip_worker.dump
  end
  ## also dump scripts
  @datafile.scripts.each do |script|
    script.dump
  end
end

#readObject


19
20
21
22
23
24
25
26
27
28
# File 'lib/datafile/workers/zip/worker.rb', line 19

def read
  ## note: also run inlines (setup script) before
  @datafile.inlines.each do |inline|
    inline.call
  end

  @datafile.datasets.each do |dataset|
    dataset.zip_worker.read
  end
end