kvx 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 +3 -2
- data.tar.gz.sig +0 -0
- data/lib/kvx.rb +25 -2
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8dda0bccf32b792dfdb62f62645b1f0e71d1d313
|
|
4
|
+
data.tar.gz: bfe3aa2f41aeb8a050bb8558ebf4e6fa0f6a02e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02b2d88b029cf1bc1ee942f3397d554f851abe6272c3c73b458896522dbe895b1e9ae80e5e7100a06dc7a9d0d7030d5030ae9368cfa6da08070c12aa167a4446
|
|
7
|
+
data.tar.gz: 224d86a8a16b33a0bf89c7d87cda6c3ee281c5565ca64f8ea7d7d3bff5f3cb11af4df38a6edbda823c6d07ac0c31968c92abe794ee55b6f933e459e5b599291e
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
�7����a9�݈��������u���r�FSs�/��Wv��G>��E!h�/��xF� �N*�e|^�Go\�
|
|
2
|
+
R���=��W#�$W�Ⱦ�g��w�L�#m�-��(�yj�3ƙ.���'���r�l`��TQ�V��`Yؽ7���7dh��iӉ����#�L��_������d>��!w,��k�uJyP����mD��ܜJ�;�7Q��Ѓ'��!>��:xiX�ꩍ���Q�
|
|
3
|
+
�P�=�o�Q?�#����V
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/kvx.rb
CHANGED
|
@@ -23,14 +23,22 @@ class Kvx
|
|
|
23
23
|
@identifier = 'kvx'
|
|
24
24
|
@attributes = attributes
|
|
25
25
|
h = {hash: :passthru, :'rexle::element' => :hashify, string: :parse_to_h}
|
|
26
|
-
@
|
|
26
|
+
@h = method(h[x.class.to_s.downcase.to_sym]).call x
|
|
27
27
|
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
def item()
|
|
31
|
+
@h
|
|
32
|
+
end
|
|
29
33
|
|
|
30
34
|
def parse(t=nil)
|
|
31
35
|
parse_to_h(t || @to_s)
|
|
32
36
|
end
|
|
33
37
|
|
|
38
|
+
def to_h()
|
|
39
|
+
deep_clone @h
|
|
40
|
+
end
|
|
41
|
+
|
|
34
42
|
def to_s()
|
|
35
43
|
|
|
36
44
|
header = ''
|
|
@@ -39,8 +47,9 @@ class Kvx
|
|
|
39
47
|
|
|
40
48
|
header = '<?' + @identifier
|
|
41
49
|
header += ' ' + @attributes.map {|x| "%s='%s'" % x }.join(' ')
|
|
42
|
-
header += "?>\n
|
|
50
|
+
header += "?>\n"
|
|
43
51
|
end
|
|
52
|
+
h = @to_h
|
|
44
53
|
|
|
45
54
|
header + scan_to_s(@to_h)
|
|
46
55
|
|
|
@@ -56,6 +65,20 @@ class Kvx
|
|
|
56
65
|
end
|
|
57
66
|
|
|
58
67
|
private
|
|
68
|
+
|
|
69
|
+
def deep_clone(h)
|
|
70
|
+
|
|
71
|
+
h.inject({}) do |r, x|
|
|
72
|
+
|
|
73
|
+
h2 = if x.last.is_a? Hash then
|
|
74
|
+
[x.first, deep_clone(x.last)]
|
|
75
|
+
else
|
|
76
|
+
x
|
|
77
|
+
end
|
|
78
|
+
r.merge h2[0] => h2[1]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
end
|
|
59
82
|
|
|
60
83
|
def get_attributes(raw_attributes)
|
|
61
84
|
|
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.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -103,6 +103,6 @@ rubyforge_project:
|
|
|
103
103
|
rubygems_version: 2.4.6
|
|
104
104
|
signing_key:
|
|
105
105
|
specification_version: 4
|
|
106
|
-
summary: Kvx (Keys,
|
|
107
|
-
|
|
106
|
+
summary: Kvx (Keys, Values, and XML) makes it convenient to store and retrieve the
|
|
107
|
+
simplest of data as plain text using a hash-like format or as XML.
|
|
108
108
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|