Class: Datafile::FileWorker

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

Overview

check: rename to FileDatafileWorker?? or FileDatafile -why, why not ??

Instance Method Summary collapse

Constructor Details

#initialize(datafile) ⇒ FileWorker

Returns a new instance of FileWorker.



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

def initialize( datafile )
  @datafile = datafile
end

Instance Method Details

#calcObject



28
29
30
31
32
# File 'lib/datafile/workers/file/worker.rb', line 28

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

#downloadObject



13
14
15
# File 'lib/datafile/workers/file/worker.rb', line 13

def download
  ## note: do NOTHING for now; assume repo already present (unpacked) on local filesystem
end

#dumpObject



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

def dump
  ## also dump inlines
  @datafile.inlines.each do |inline|
    inline.dump
  end

  @datafile.datasets.each do |dataset|
    dataset.file_worker.dump
  end

  ## also dump scripts
  @datafile.scripts.each do |script|
    script.dump
  end
end

#readObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/datafile/workers/file/worker.rb', line 17

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

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