Class: CsvHelper::Local

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

Constant Summary collapse

LOCAL_RESULT_CSV =
'local_result_csvs'

Constants inherited from Base

Base::CSV_RESULTS_DIR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#filename, #filepath

Constructor Details

#initialize(result_id) ⇒ Local

Returns a new instance of Local.



7
8
9
10
11
12
# File 'lib/csv_helper/local.rb', line 7

def initialize(result_id)
  super(result_id)
  FileUtils.mkdir_p(File.join('public', LOCAL_RESULT_CSV))
  @url = File.join(LOCAL_RESULT_CSV, filename)
  @local_url = File.join('public', @url)
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/csv_helper/local.rb', line 4

def url
  @url
end

Instance Method Details

#store!Object



14
15
16
# File 'lib/csv_helper/local.rb', line 14

def store!
  FileUtils.copy(filepath, @local_url)
end