Class: PgCsv

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/pg_csv.rb,
lib/pg_csv/version.rb

Defined Under Namespace

Modules: Base

Constant Summary collapse

VERSION =
"0.3"

Class Method Summary collapse

Methods included from Base

#export, #initialize

Class Method Details

.with_temp_file(dest, tmp_dir = '/tmp', &block) ⇒ Object



204
205
206
207
208
209
210
211
# 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