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.
@@ -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
- CSV.open(self.const_get('DATABASE_LOCATION'), mode, headers: true) do |csv|
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
@@ -1,6 +1,6 @@
1
1
  module CsvRecord
2
2
  MAJOR = 2
3
3
  MINOR = 1
4
- PATCH = 1
4
+ PATCH = 2
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: