kvx 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/kvx.rb +29 -7
- 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: c255b6ca87fbc7ec29656a2f7e33a4bf6770f33fbdeb17a9ec9743051055530f
|
4
|
+
data.tar.gz: baffbe4607834ba2ef49c78b21059b92d9e344d5c6fdd9d7a04252d2d0409d49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c03ade6587fa5c1475aac9badde784b5929766d60d59ea53d70ca698b9bbe973acfcf9f4173ab5c2056dba13acb102b7a5c2fba509897f504b10d299489032b5
|
7
|
+
data.tar.gz: c38a4f5f215403a51006cfd1004a8a7a5977e3a034c9d994445c58a48bbd8fa5c7976e60691309c0013a17781d64dfaeb12e802e9c820ad099450785da34f022
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/kvx.rb
CHANGED
@@ -36,7 +36,7 @@ class Kvx
|
|
36
36
|
|
37
37
|
def initialize(x=nil, attributes: {}, debug: false)
|
38
38
|
|
39
|
-
@header =
|
39
|
+
@header = attributes.any?
|
40
40
|
@identifier = 'kvx'
|
41
41
|
@summary = {}
|
42
42
|
@ignore_blank_lines ||= false
|
@@ -76,12 +76,23 @@ class Kvx
|
|
76
76
|
FileX.write filename, self.to_s
|
77
77
|
end
|
78
78
|
|
79
|
-
|
79
|
+
# flattening is helpful when passing the Hash object to
|
80
|
+
# RecordX as a new record
|
81
|
+
#
|
82
|
+
def to_h(flatten: false)
|
80
83
|
|
81
84
|
if @summary.empty? then
|
85
|
+
|
82
86
|
deep_clone @body
|
87
|
+
|
83
88
|
else
|
84
|
-
|
89
|
+
|
90
|
+
if flatten then
|
91
|
+
@summary.merge @body
|
92
|
+
else
|
93
|
+
{summary: deep_clone(@summary), body: deep_clone(@body)}
|
94
|
+
end
|
95
|
+
|
85
96
|
end
|
86
97
|
|
87
98
|
end
|
@@ -137,8 +148,12 @@ class Kvx
|
|
137
148
|
header = '<?' + @identifier
|
138
149
|
header += attr
|
139
150
|
header += "?>\n"
|
140
|
-
|
141
|
-
|
151
|
+
|
152
|
+
if @summary and @summary.any? then
|
153
|
+
header += scan_to_s @summary
|
154
|
+
header += "\n----------------------------------\n\n"
|
155
|
+
end
|
156
|
+
|
142
157
|
end
|
143
158
|
|
144
159
|
# -- use the nested description Hash object if there are multiple lines
|
@@ -170,6 +185,13 @@ class Kvx
|
|
170
185
|
doc.xml(options)
|
171
186
|
|
172
187
|
end
|
188
|
+
|
189
|
+
# used by RecordX to update a KVX record
|
190
|
+
# id is unnecssary because there is only 1 record mapped to RecordX
|
191
|
+
#
|
192
|
+
def update(id=nil, hpair={})
|
193
|
+
@body.merge! hpair
|
194
|
+
end
|
173
195
|
|
174
196
|
private
|
175
197
|
|
@@ -270,7 +292,7 @@ class Kvx
|
|
270
292
|
@attributes.merge! attr
|
271
293
|
@header = true
|
272
294
|
body, summary = a.join.strip.split(/^----*$/).reverse
|
273
|
-
@summary = scan_to_h summary
|
295
|
+
@summary = scan_to_h summary if summary
|
274
296
|
|
275
297
|
body
|
276
298
|
else
|
@@ -326,7 +348,7 @@ class Kvx
|
|
326
348
|
|
327
349
|
if line.join.length > 0 then
|
328
350
|
|
329
|
-
r2 = if line[0][0][/^[^:]
|
351
|
+
r2 = if line[0][0][/^[^:]+: /] then
|
330
352
|
|
331
353
|
padding = line[0].length < 2 ? "\n" : "\n "
|
332
354
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kvx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
m/+jxdgFjKKGxeZqunu9cp5ca9wSjjtKh/VA/3xZtPwokCa7vCMB+ZxUP0jvd++u
|
36
36
|
OTXy8k/zqddw/VfD/It1UUK4
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-
|
38
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: line-tree
|
metadata.gz.sig
CHANGED
Binary file
|