dxlite 0.2.0 → 0.2.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 +10 -5
- metadata +1 -1
- 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: e036712cdb12ebc28440edcfff5e89a9d7e3cd4bc92c5eeca4545b2158b3ad8d
|
4
|
+
data.tar.gz: '020807c1206d1388f60fc55facbe865fc2be92ee9ca9c4d8d4af8741073492cc'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33fabd7df1cbd07065b2627c4c6a56941b6ba68812b86ae3672fba34bc8f0ed06afc940af162217ed34385337f310b4154e5c900cea4d2cb7fbc8f12339be048
|
7
|
+
data.tar.gz: f16f8874284397716679de4b6f6a7e79e6145767b46d12fca47aca0895a1221ce592fd4e38bf0c8d5751fc81a3bf1a3fa4a978e50eb6b6c63e8e606de6b427d3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dxlite.rb
CHANGED
@@ -13,9 +13,9 @@ class DxLite
|
|
13
13
|
attr_accessor :summary
|
14
14
|
attr_reader :records
|
15
15
|
|
16
|
-
def initialize(s, debug: false)
|
16
|
+
def initialize(s, filepath: nil, debug: false)
|
17
17
|
|
18
|
-
@debug = debug
|
18
|
+
@filepath, @debug = filepath, debug
|
19
19
|
|
20
20
|
buffer, type = RXFHelper.read(s)
|
21
21
|
puts 'type: ' + type.inspect if @debug
|
@@ -39,8 +39,11 @@ class DxLite
|
|
39
39
|
|
40
40
|
@schema = @summary[:schema]
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
summary = @summary[:schema][/(?<=\[)[^\]]+/]
|
43
|
+
|
44
|
+
if summary then
|
45
|
+
@summary.merge! summary.split(',').map {|x|[x.strip, nil] }.to_h
|
46
|
+
end
|
44
47
|
|
45
48
|
# for each summary item create get and set methods
|
46
49
|
|
@@ -102,9 +105,11 @@ class DxLite
|
|
102
105
|
alias import parse
|
103
106
|
|
104
107
|
def save(file=@filepath)
|
105
|
-
File.write file, @records.to_json
|
108
|
+
File.write file, {summary: @summary, records: @records}.to_json
|
106
109
|
end
|
107
110
|
|
111
|
+
alias to_a records
|
112
|
+
|
108
113
|
# Updates a record from an id and a hash containing field name and field value.
|
109
114
|
# dynarex.update 4, name: Jeff, age: 38
|
110
115
|
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|