Class: CsvHelper::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/csv_helper/base.rb

Direct Known Subclasses

Aws, Local

Constant Summary collapse

CSV_RESULTS_DIR =
'/tmp'

Instance Method Summary collapse

Constructor Details

#initialize(result_id) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
# File 'lib/csv_helper/base.rb', line 6

def initialize(result_id)
  @result_id = result_id
  @tmp_results_dir = File.join(Rails.root, CSV_RESULTS_DIR)
  FileUtils.mkdir_p(@tmp_results_dir)
end

Instance Method Details

#filenameObject



16
17
18
# File 'lib/csv_helper/base.rb', line 16

def filename
  "#{@result_id}.csv"
end

#filepathObject



12
13
14
# File 'lib/csv_helper/base.rb', line 12

def filepath
  File.join(@tmp_results_dir, filename)
end