kvx 0.7.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/kvx.rb +31 -4
  5. metadata +9 -9
  6. metadata.gz.sig +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cd1be9cd3370796707ca6191b5a501c15f4018b6bf63897ece6f8d057106608
4
- data.tar.gz: 99c9f55cc660bf7708c2988548aa9dcbcc1c7dbb095b96e0dcdacdf54f91e9d9
3
+ metadata.gz: e453cda79bd19a566142d148a2668f74e339c1adb46739d707e04c1091ca2447
4
+ data.tar.gz: 697d68ced082374ee4abadb8993581a982b7f997660105e1435576f8e9c15e57
5
5
  SHA512:
6
- metadata.gz: c9955b9d32879f63809fb214ea8d125f67bc40005ef48508365466fc8d86bd7e2f2dfc11db909c11a9d176c8b8d3c5bba502a0576438b5beebdedf094a680181
7
- data.tar.gz: ffd67e264ed849c10d371f77cd4679e2fcd8acee8eb39b761c5c61d50914430a90de8dedf179b60ba3e90939f8025b952e5d9873fa80233e5b970c435c3a84ab
6
+ metadata.gz: 4ef708c50320556c27d288306e26d5bbdd11e7f9290d5a7169eb364c50e4f2bf906c09880d6431e57c423fc960a20aae01f4fcc3b08458355710eff276d8cf6d
7
+ data.tar.gz: 5eb81be50bb052b99d628b153dbd8cf91228d94765d7bb95862eeca7a9ed9319634def9fa42d3808ea9ca7abcccd1b4f9663fa791b39addc70d5c88e7c17675a
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,17 @@ class Kvx
37
51
  :"rexle::element::value" => :parse_string
38
52
  }
39
53
 
40
- @body = method(h[x.class.to_s.downcase.to_sym]).call x
41
- @body.each do |k,v|
42
- define_singleton_method(k){v} unless self.methods.include? k
54
+ if x then
55
+ @body = method(h[x.class.to_s.downcase.to_sym]).call x
56
+ methodize(@body)
43
57
  end
44
58
 
45
59
  end
60
+
61
+ def import(s)
62
+ @body = parse_string(s)
63
+ methodize(@body)
64
+ end
46
65
 
47
66
  def item()
48
67
  @body
@@ -176,6 +195,14 @@ class Kvx
176
195
  buffer.lstrip =~ /^<\?xml/ ? xml_to_h(Rexle.new(buffer).root) : parse_to_h(buffer)
177
196
 
178
197
  end
198
+
199
+ def methodize(h)
200
+
201
+ h.each do |k,v|
202
+ define_singleton_method(k){v} unless self.methods.include? k
203
+ end
204
+
205
+ end
179
206
 
180
207
  def parse_to_h(s, header_pattern: %r(^<\?kvx[\s\?]))
181
208
 
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.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -38,40 +38,40 @@ dependencies:
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.6'
41
+ version: '0.7'
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.6.8
44
+ version: 0.7.2
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - "~>"
50
50
  - !ruby/object:Gem::Version
51
- version: '0.6'
51
+ version: '0.7'
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.6.8
54
+ version: 0.7.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rxfhelper
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.6'
61
+ version: '0.9'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 0.6.1
64
+ version: 0.9.1
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: '0.6'
71
+ version: '0.9'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 0.6.1
74
+ version: 0.9.1
75
75
  description:
76
76
  email: james@jamesrobertson.eu
77
77
  executables: []
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- 3�Cg�>8���_Q��#鐱�i����i�i����Z�1�9(��I7����%�gu��?��������T��")D�����$]��@*�����u���Zԙ8<\�l��"�>D�_�#�b<�Z]ڍL\�1��҄��˾9x��Eom�n���S��wJ�������
1
+ ���uF)h]�v ��`����}<@���*��MtR�&i��p(�P�ָ1
2
+ r��E�ް~O��s�o�+6f�x񧧥�|��"�?I������4��`r)� �{��Z��.�VR�׾�-Ҫ����$��f�W�� =���e�Q�k�%]t