rowx 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7484fc4c3bd97845777c5511fd5c982dd75c4bd0
4
- data.tar.gz: f63d0e3c7b0ab4147d46d2f82bf047ca8afb9e44
3
+ metadata.gz: 5a367896f310d110e34515571524f069b65397f7
4
+ data.tar.gz: c3335372d9a21754445b206ba1a99af51824e089
5
5
  SHA512:
6
- metadata.gz: e9dcc175571008052849b74b64677fad8cf6cc6aab15fa6df54cb7902b02cf658655030e5624e2334c7b4d9b37f3f57e8756a9e1843ca4feb443e85cec4ccb77
7
- data.tar.gz: 49b133f254ed652b576b38f33ff6bcd1d16837953cfe786ff67d152bfb80c9bd6f41b2df541fc270e209bc9469cb1ccd7c2b3f2caa7f344859eec39b61cbf8df
6
+ metadata.gz: 132d7b2b03b8aae5b88fb4f0028265ec59103c315bdb20108620454b48a6e8cdd7fd16706efefa2e958af5e21df3b99a01293d1398a78ef8e93395cb57da2bc6
7
+ data.tar.gz: e7f64ce9e1e41a52b7d08692399c6407ab12a8fa449aae31b8360d68a9324f84d4dfeedbdc4624153190a2e0f72dcf42a863702cea346f3241ad09ff94f35f05
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rowx.rb CHANGED
@@ -26,7 +26,20 @@ class RowX
26
26
 
27
27
  def initialize(txt)
28
28
 
29
- a = LineTree.new(txt.gsub(/^-*$/m,'')).to_a
29
+ a3 = txt.split(/(?:\n|^\-+$)\n/)
30
+ # get the fields
31
+ a4 = a3.map{|x| x.scan(/\w+(?=:)/)}.flatten(1).uniq
32
+ a5 = a3.map do |xlines|
33
+
34
+ missing_fields = a4 - xlines.scan(/^\w+(?=:)/)
35
+ r = xlines.lines.map(&:strip)
36
+ r += missing_fields.map{|x| x + ":"}
37
+ r.sort.join("\n")
38
+
39
+ end
40
+ a6 = a5.join("\n\n")
41
+
42
+ a = LineTree.new(a6).to_a
30
43
 
31
44
  keyfield = a[0][0][/\w+/]; i = 0
32
45
 
@@ -40,7 +53,7 @@ class RowX
40
53
  summary = scan_a a.slice!(0,i)
41
54
 
42
55
  summary[0] = 'summary'
43
- @to_a = ['root', '', {}] + [summary] + scan_records(records)
56
+ @to_a = ['root', '', {}] + [summary] + scan_records(records)
44
57
  @to_xml = Rexle.new(@to_a).xml pretty: true
45
58
 
46
59
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rowx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -29,7 +29,7 @@ cert_chain:
29
29
  uXUwmNalFJIXxQzr4trZWuBNI64wIqhFnjEQHG2N9HUyaGwkK5TznpUM8KEqDnDk
30
30
  fXbCnu8uH0gz42PqnrqiE7yzaUNWh3VM
31
31
  -----END CERTIFICATE-----
32
- date: 2013-07-27 00:00:00.000000000 Z
32
+ date: 2013-08-07 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: line-tree
metadata.gz.sig CHANGED
Binary file