kvx 0.7.3 → 0.9.2
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/kvx.rb +75 -9
- metadata +39 -34
- 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: 96cfc3e8b1006b34c301f6753f35be06d1488fbfc3233094269c0d6cf61560a6
|
4
|
+
data.tar.gz: d706f6a62e289443c0fc90a09a49ca29a2001de59e8f59420da4cd3cb345d3a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da3953a0cbfbf07a8116eaa7365c8d0e0074c356d57e4f1c894f85c2eb6cbe6a218db580c1cf066ba15153eb193fe097c978e2d4f4cbe134fb7552052166831d
|
7
|
+
data.tar.gz: 9291206b7516b575363a4965fc1d3fa816e888f35a768c286162df1bebc5528aa0e9dd70659f436472424e73a51e30711317fd18faea435bb4c47626983afe08
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/kvx.rb
CHANGED
@@ -6,6 +6,20 @@ require 'line-tree'
|
|
6
6
|
require 'rxfhelper'
|
7
7
|
require 'rexle-builder'
|
8
8
|
|
9
|
+
module RegGem
|
10
|
+
|
11
|
+
def self.register()
|
12
|
+
'
|
13
|
+
hkey_gems
|
14
|
+
doctype
|
15
|
+
kvx
|
16
|
+
require kvx
|
17
|
+
class Kvx
|
18
|
+
media_type kvx
|
19
|
+
'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
9
23
|
###
|
10
24
|
# Kvx does the following:
|
11
25
|
#
|
@@ -20,7 +34,7 @@ class Kvx
|
|
20
34
|
attr_accessor :attributes, :summary
|
21
35
|
attr_reader :to_h
|
22
36
|
|
23
|
-
def initialize(x, attributes: {}, debug: false)
|
37
|
+
def initialize(x=nil, attributes: {}, debug: false)
|
24
38
|
|
25
39
|
@header = false
|
26
40
|
@identifier = 'kvx'
|
@@ -37,12 +51,20 @@ class Kvx
|
|
37
51
|
:"rexle::element::value" => :parse_string
|
38
52
|
}
|
39
53
|
|
40
|
-
|
41
|
-
|
42
|
-
|
54
|
+
if x then
|
55
|
+
|
56
|
+
sym = h[x.class.to_s.downcase.to_sym]
|
57
|
+
puts 'sym: ' + sym.inspect if @debug
|
58
|
+
@body = method(sym).call x
|
59
|
+
methodize(@body)
|
43
60
|
end
|
44
61
|
|
45
62
|
end
|
63
|
+
|
64
|
+
def import(s)
|
65
|
+
@body = parse_string(s)
|
66
|
+
methodize(@body)
|
67
|
+
end
|
46
68
|
|
47
69
|
def item()
|
48
70
|
@body
|
@@ -82,12 +104,25 @@ class Kvx
|
|
82
104
|
end
|
83
105
|
|
84
106
|
summary = [:summary, {}, *summary]
|
85
|
-
|
107
|
+
|
108
|
+
# -- use the nested description Hash object if there are multiple lines
|
109
|
+
h = {}
|
110
|
+
|
111
|
+
@body.each do |key, value|
|
112
|
+
|
113
|
+
h[key] = value.is_a?(String) ? value : value[:description]
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
body = [:body, {}, *make_xml(h)]
|
86
118
|
[self.class.to_s.downcase, @attributes, '', summary, body]
|
87
119
|
|
88
120
|
end
|
89
121
|
|
90
|
-
|
122
|
+
puts 'a: ' + a.inspect if @debug
|
123
|
+
doc = Rexle.new a
|
124
|
+
doc.instructions = @instructions || []
|
125
|
+
doc
|
91
126
|
|
92
127
|
end
|
93
128
|
|
@@ -105,8 +140,18 @@ class Kvx
|
|
105
140
|
header += scan_to_s @summary
|
106
141
|
header += "\n----------------------------------\n\n"
|
107
142
|
end
|
143
|
+
|
144
|
+
# -- use the nested description Hash object if there are multiple lines
|
145
|
+
h = {}
|
108
146
|
|
109
|
-
|
147
|
+
@body.each do |key, value|
|
148
|
+
|
149
|
+
h[key] = value.is_a?(String) ? value : \
|
150
|
+
"\n" + value[:description].lines.map {|x| ' ' + x }.join
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
header + scan_to_s(h)
|
110
155
|
|
111
156
|
end
|
112
157
|
|
@@ -166,14 +211,32 @@ class Kvx
|
|
166
211
|
end
|
167
212
|
|
168
213
|
def make_xml(h)
|
169
|
-
|
214
|
+
|
215
|
+
puts 'inside make_xml: ' + h.inspect if @debug
|
216
|
+
RexleBuilder.new(h, debug: false).to_a[3..-1]
|
170
217
|
end
|
171
218
|
|
172
219
|
def parse_string(s)
|
173
220
|
|
174
221
|
buffer, type = RXFHelper.read(s)
|
175
222
|
puts ('buffer: ' + buffer.inspect).debug if @debug
|
176
|
-
|
223
|
+
|
224
|
+
if buffer.lstrip =~ /^<\?xml/ then
|
225
|
+
doc = Rexle.new(buffer)
|
226
|
+
@instructions = doc.instructions
|
227
|
+
puts '@instructions: ' + @instructions.inspect if @debug
|
228
|
+
xml_to_h(doc.root)
|
229
|
+
else
|
230
|
+
parse_to_h(buffer)
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
def methodize(h)
|
236
|
+
|
237
|
+
h.each do |k,v|
|
238
|
+
define_singleton_method(k){v} unless self.methods.include? k
|
239
|
+
end
|
177
240
|
|
178
241
|
end
|
179
242
|
|
@@ -313,6 +376,9 @@ class Kvx
|
|
313
376
|
|
314
377
|
def xml_to_h(node)
|
315
378
|
|
379
|
+
puts 'node: ' + node.xml.inspect if @debug
|
380
|
+
@attributes = node.attributes.to_h
|
381
|
+
|
316
382
|
summary = node.element('summary')
|
317
383
|
|
318
384
|
if summary then
|
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.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwMjIwMjI0ODU5WhcN
|
15
|
+
MjIwMjIwMjI0ODU5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDEZUlA
|
17
|
+
5Xwb1PhCpUwcey7fBjLJHAHnBg9lFLAFNGWr1QDpH166qx7w9Q9ckPeFNMiH5ZFs
|
18
|
+
/D9GrO+BVU3Lz5/CaL3q5eB3L8+JC+VjNiJijvynBa2TeB2aenlRqdUqvJ/RGTu0
|
19
|
+
9v8tWq/Mn3batCRCpuLJJ25C49hyzYts2UWetRAqfuvukJY+BoPISYntAs3g2elo
|
20
|
+
Za/9sY69ezCvOmwyw+B8dGXjqINlZxJKfuR3xf87uR/4vBC9DI4EE7dS1pjsyDws
|
21
|
+
d3e9fBWBKIMaZVdshc9rAnP6ARhWMnxYUjjqUDJiqXz5137HmWSOGWGGrnX0pfg2
|
22
|
+
WPVI7jN39s6Gd2nNGOgaiwlNpcNS7IPYHGU2+mDJxWSKn+suMjendpi/WSTQlLG4
|
23
|
+
PEZBk+B6CEy6yOLU4x5GN3US7wbwLOl0ASSAhb4vAG81pGIRYt5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tree
|
@@ -38,40 +43,40 @@ dependencies:
|
|
38
43
|
requirements:
|
39
44
|
- - "~>"
|
40
45
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0.
|
46
|
+
version: '0.9'
|
42
47
|
- - ">="
|
43
48
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.
|
49
|
+
version: 0.9.1
|
45
50
|
type: :runtime
|
46
51
|
prerelease: false
|
47
52
|
version_requirements: !ruby/object:Gem::Requirement
|
48
53
|
requirements:
|
49
54
|
- - "~>"
|
50
55
|
- !ruby/object:Gem::Version
|
51
|
-
version: '0.
|
56
|
+
version: '0.9'
|
52
57
|
- - ">="
|
53
58
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
59
|
+
version: 0.9.1
|
55
60
|
- !ruby/object:Gem::Dependency
|
56
61
|
name: rxfhelper
|
57
62
|
requirement: !ruby/object:Gem::Requirement
|
58
63
|
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.6'
|
62
64
|
- - ">="
|
63
65
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.
|
66
|
+
version: 1.0.0
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
65
70
|
type: :runtime
|
66
71
|
prerelease: false
|
67
72
|
version_requirements: !ruby/object:Gem::Requirement
|
68
73
|
requirements:
|
69
|
-
- - "~>"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '0.6'
|
72
74
|
- - ">="
|
73
75
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
76
|
+
version: 1.0.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '1.0'
|
75
80
|
description:
|
76
81
|
email: james@jamesrobertson.eu
|
77
82
|
executables: []
|
@@ -99,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
104
|
version: '0'
|
100
105
|
requirements: []
|
101
106
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.7.
|
107
|
+
rubygems_version: 2.7.10
|
103
108
|
signing_key:
|
104
109
|
specification_version: 4
|
105
110
|
summary: Kvx (Keys, Values, and XML) makes it convenient to store and retrieve the
|
metadata.gz.sig
CHANGED
Binary file
|