tadb 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tadb.rb +1 -1
- data/lib/tadb/table.rb +10 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5402411b27ddb23194835e49002e3888cc934900b8516fd120ced85c7135a183
|
4
|
+
data.tar.gz: 7f9b1468c0a330d5b19c347b124562a4e20bd6190fe42e1705610e29fb8fd3cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 519d4e21077de739ecbd940f3cda39f6902ac2582dc422c03eb808ee8122d9236881b504ca93fbacecfe588f65391a782788983f953534f0c693436144694a09
|
7
|
+
data.tar.gz: 27c00935960a1a18ed6138ea904439cf3e7c3419c635dcb3b32b04139005a2066b779b0dc5da65f06346face932c71bb65d46ed8c8338dd468c9286eefe97d0e
|
data/lib/tadb.rb
CHANGED
data/lib/tadb/table.rb
CHANGED
@@ -10,7 +10,7 @@ class TADB::Table
|
|
10
10
|
def entries
|
11
11
|
file('r') do |f|
|
12
12
|
f.readlines.map do |line|
|
13
|
-
JSON.parse(line
|
13
|
+
JSON.parse(line, symbolize_names: true)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -38,7 +38,9 @@ class TADB::Table
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def clear
|
41
|
-
File.open(db_path, 'w')
|
41
|
+
File.open(db_path, 'w') do |f|
|
42
|
+
f.sync = true
|
43
|
+
end
|
42
44
|
end
|
43
45
|
|
44
46
|
private
|
@@ -47,7 +49,12 @@ class TADB::Table
|
|
47
49
|
Dir.mkdir('./db') unless File.exists?('./db')
|
48
50
|
clear unless File.exists?(db_path)
|
49
51
|
|
50
|
-
File.open(db_path, mode)
|
52
|
+
File.open(db_path, mode) do |file|
|
53
|
+
# The new File object is buffered mode (or non-sync mode), unless filename is a tty. See IO#flush, IO#fsync, IO#fdatasync, and IO#sync= about sync mode.
|
54
|
+
puts "Forcing sync on file #{db_path}..."
|
55
|
+
file.sync = true # https://ruby-doc.org/core-3.0.0/File.html#method-c-new-label-Examples
|
56
|
+
block.call(file)
|
57
|
+
end
|
51
58
|
end
|
52
59
|
|
53
60
|
def db_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tadb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- UTN FRBA - TADP
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-collection_matchers
|
@@ -69,6 +69,7 @@ dependencies:
|
|
69
69
|
description: Toy file based object storage for academic purposes
|
70
70
|
email:
|
71
71
|
- erwincdl@gmail.com
|
72
|
+
- ebossicarranza@frba.utn.edu.ar
|
72
73
|
executables: []
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
@@ -96,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
97
|
- !ruby/object:Gem::Version
|
97
98
|
version: '0'
|
98
99
|
requirements: []
|
99
|
-
rubygems_version: 3.1
|
100
|
+
rubygems_version: 3.2.0.rc.1
|
100
101
|
signing_key:
|
101
102
|
specification_version: 4
|
102
103
|
summary: File based storage
|