csv_record 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/csv_record/connector.rb +3 -1
- data/lib/csv_record/version.rb +1 -1
- metadata +1 -1
data/lib/csv_record/connector.rb
CHANGED
@@ -31,7 +31,8 @@ module CsvRecord::Connector
|
|
31
31
|
# +mode+:: the operation mode (defaults to READ_MODE)
|
32
32
|
def __open_database_file__(mode=READ_MODE)
|
33
33
|
__initialize_db__ if mode == READ_MODE # fix this later
|
34
|
-
|
34
|
+
db_location = self.const_get('DATABASE_LOCATION')
|
35
|
+
CSV.open(db_location, mode, headers: true) do |csv|
|
35
36
|
yield csv
|
36
37
|
end
|
37
38
|
end
|
@@ -56,6 +57,7 @@ module CsvRecord::Connector
|
|
56
57
|
def rename_database
|
57
58
|
old_file = self.const_get 'DATABASE_LOCATION'
|
58
59
|
tmp_file = self.const_get 'DATABASE_LOCATION_TMP'
|
60
|
+
while not File.exists?(old_file) ; sleep(10) ; end
|
59
61
|
File.delete old_file
|
60
62
|
File.rename tmp_file, old_file
|
61
63
|
end
|
data/lib/csv_record/version.rb
CHANGED