class PgCsv

Constants

VERSION

Public Class Methods

with_temp_file(dest, tmp_dir = '/tmp', &block) click to toggle source
# File lib/pg_csv.rb, line 204
def self.with_temp_file(dest, tmp_dir = '/tmp', &block)
  require 'fileutils'

  filename = File.join(tmp_dir, "pg_csv_#{Time.now.to_f}_#{rand(1000000)}")
  block[filename]

  FileUtils.mv(filename, dest)
end