dxlite 0.3.0 → 0.3.1
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dxlite.rb +24 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e750d486323e8a58475cb5471ce9724fb1e74c723aade42c9ed8e8b8eeb146
|
4
|
+
data.tar.gz: 1fa49e26bd6b74fcbc68cfde7a7ff38746adb1227de26bd7241ff2c494eb2127
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fc7a7fe58be371ba3ae9120cba0cad446917c55c8e5e438ebe9be4b74eefca0f2bf36b48813683d406fda740c45b1de9aed0b773a1815c624344b8d978f6bc7
|
7
|
+
data.tar.gz: c82bde55b5410360b3e2114750e24bf8ce6b7747913b6e9dbcc6e38e47549407171ea836cfcc251d0025d6a91bd6b8c160109711d69687e2d975898fbdf57fe7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dxlite.rb
CHANGED
@@ -14,12 +14,15 @@ class DxLite
|
|
14
14
|
attr_accessor :summary
|
15
15
|
attr_reader :records
|
16
16
|
|
17
|
-
def initialize(s=nil,
|
17
|
+
def initialize(s=nil, autosave: false, debug: false)
|
18
18
|
|
19
|
-
@
|
19
|
+
@autosave, @debug = autosave, debug
|
20
20
|
|
21
21
|
return unless s
|
22
22
|
buffer, type = RXFHelper.read(s)
|
23
|
+
|
24
|
+
@filepath = s if type == :file or type == :dfs
|
25
|
+
|
23
26
|
puts 'type: ' + type.inspect if @debug
|
24
27
|
puts 'buffer: ' + buffer.inspect if @debug
|
25
28
|
|
@@ -80,7 +83,12 @@ class DxLite
|
|
80
83
|
|
81
84
|
def delete(id)
|
82
85
|
found = @records.find {|x| x[:id] == id}
|
83
|
-
|
86
|
+
|
87
|
+
if found then
|
88
|
+
@records.delete found
|
89
|
+
save() if @autosave
|
90
|
+
end
|
91
|
+
|
84
92
|
end
|
85
93
|
|
86
94
|
def create(rawh, id: nil, custom_attributes: {created: Time.now})
|
@@ -90,6 +98,8 @@ class DxLite
|
|
90
98
|
h = fields.map {|x| [x.to_sym, nil] }.to_h.merge(rawh)
|
91
99
|
@records << {id: id.to_s, created: h2[:created], last_modified: nil,
|
92
100
|
body: h}
|
101
|
+
|
102
|
+
save() if @autosave
|
93
103
|
end
|
94
104
|
|
95
105
|
def fields()
|
@@ -155,6 +165,9 @@ class DxLite
|
|
155
165
|
end
|
156
166
|
|
157
167
|
def save(file=@filepath)
|
168
|
+
|
169
|
+
return unless file
|
170
|
+
|
158
171
|
s = File.extname(file) == '.json' ? to_json() : to_xml()
|
159
172
|
File.write file, s
|
160
173
|
end
|
@@ -222,7 +235,14 @@ class DxLite
|
|
222
235
|
end
|
223
236
|
|
224
237
|
r = @records.find {|x| x[:id] == id}
|
225
|
-
|
238
|
+
|
239
|
+
if r then
|
240
|
+
|
241
|
+
r[:body].merge!(obj)
|
242
|
+
save() if @autosave
|
243
|
+
|
244
|
+
end
|
245
|
+
|
226
246
|
end
|
227
247
|
|
228
248
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dxlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
dwbAN6/wokoLVZAiMRG1vZlI6RhtSOTHvFHbfBE5JI9rhjRtui8yeV+t8iI8G4Zs
|
36
36
|
2NszuYzdlVfzlrUiPWY5jL9P
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-01-
|
38
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: recordx
|
metadata.gz.sig
CHANGED
Binary file
|