Class: Hakoy::AppendStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/hakoy/append_strategy.rb

Instance Method Summary collapse

Instance Method Details

#append_row_to_file(file_path, row_hash) ⇒ Object



3
4
5
# File 'lib/hakoy/append_strategy.rb', line 3

def append_row_to_file(file_path, row_hash)
  memory[file_path] << row_hash
end

#finalize!(opts) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/hakoy/append_strategy.rb', line 7

def finalize!(opts)
  uid_key      = opts.fetch(:uid_key)
  keys_mapping = opts.fetch(:keys_mapping)

  memory.each do |file_path, rows_hash|
    FileAppender.(file_path, rows_hash, uid_key: uid_key, keys_mapping: keys_mapping)
  end
end