xml-registry 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f717791f3bc8588aecdb8e813d51034ff38b283e
4
- data.tar.gz: bbe154e760170b1adcf1d9238f0aa8ee610c40a4
3
+ metadata.gz: e5a926d40bd97d05e0ca799202af429ed4e98c8b
4
+ data.tar.gz: 7024f4f799a56ef3c2e4fb9b169b10a125794574
5
5
  SHA512:
6
- metadata.gz: 6858b0011729777ef8a9f4dd70e0c598d1d74c984a8b2d453ef49d056658ff0f7f4615a41a6a3923c55751fadf93e59310add51e2657d82b0a0f7529648d98ea
7
- data.tar.gz: 3765eae3a9ff5853ad7f7519a9b183305e74876dc5757b80ee8857e611051ec9f8e3b233ba6589a9fbd475c959930db9e1e43deffb870b25ed8c0b950f1e4778
6
+ metadata.gz: 4b2cfb269ca6aa448f4fa6324d5b6208dc3044e0372506a3cd16335ad663916c1ad114c47f87bd11a1e224f519f506cda5625a00028453841e88f2e4eb23c8ce
7
+ data.tar.gz: 2eb0f73f79ce139284e1f6ac580eccd490a2218c91b6bf2d2c49256843723956a510ed456333f52e12ad34ee6b48a5f93deafa440931f62e0f1797d74a81fe38
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/xml-registry.rb CHANGED
@@ -1,9 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
- # file: xml-registry.rb
4
-
5
- require 'rexle'
6
-
7
1
  class XMLRegistry
8
2
 
9
3
  attr_reader :doc
@@ -114,10 +108,26 @@ class XMLRegistry
114
108
  def import(s)
115
109
  reg_buffer = read(s)
116
110
 
117
- reg_items = reg_buffer.gsub(/\n/,'').split(/(?=\[.[^\]]+\])/).map do |x|
118
- [x[/^\[(.[^\]]+)\]/,1], Hash[*($').scan(/"([^"]+)"="(.[^"]*)"/).flatten]]
119
- end
111
+ if s.strip[/^\[/] then
120
112
 
113
+ reg_items = reg_buffer.gsub(/\n/,'').split(/(?=\[.[^\]]+\])/).map do |x|
114
+ [x[/^\[(.[^\]]+)\]/,1], Hash[*($').scan(/"([^"]+)"="(.[^"]*)"/).flatten]]
115
+ end
116
+
117
+ else
118
+
119
+ reg_items = s.split(/(?=^[^:]+$)/).map do |raw_section|
120
+
121
+ lines = raw_section.lines.to_a
122
+ next if lines.first.strip.empty?
123
+ path = lines.shift.chomp
124
+ [path, Hash[lines.map{|x| x.split(':',2).map(&:strip)}]]
125
+ end
126
+
127
+ reg_items.compact!
128
+
129
+ end
130
+
121
131
  reg_items.each do |path, items|
122
132
  items.each {|k,value| self.set_key("%s/%s" % [path,k], value)}
123
133
  end
@@ -188,6 +198,4 @@ class XMLRegistry
188
198
  out
189
199
  end
190
200
 
191
- end
192
-
193
-
201
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -29,7 +29,7 @@ cert_chain:
29
29
  m8++OvC3wZJ60rgKYqxfVYDFYuaMttCZlmtJeF5LerbwGPPIjGwvIeYDLqBJRuA6
30
30
  4KclOqKpfBFvuefX+F9YSO3aO94nnzhV
31
31
  -----END CERTIFICATE-----
32
- date: 2013-07-30 00:00:00.000000000 Z
32
+ date: 2013-08-10 00:00:00.000000000 Z
33
33
  dependencies: []
34
34
  description:
35
35
  email: james@r0bertson.co.uk
metadata.gz.sig CHANGED
Binary file