rowx 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rowx.rb +9 -11
- metadata +2 -2
- metadata.gz.sig +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32439468aa45edff5931a95a57471a88c4e7d23a
|
4
|
+
data.tar.gz: badee3d8c712f222dacd1cc7b2bc445fd8b4efd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3d4d713e6349d784b39dd110b26d848ca648e1deae7e75e07aaaf9243dbafc9b90589ffd121bfee50f41fe4fc30926a0e6ed6d6d0a911851948579cbecabb21
|
7
|
+
data.tar.gz: a6325581ebc8ef3df217bab08c94bb8dc751f0087891446a1caad26ef278da8eb86b2d2a31c75b537b2af88769f061aa7f9386d38d9f892b28d451e14fe305a8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rowx.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'line-tree'
|
6
6
|
require 'rexle'
|
7
7
|
|
8
|
-
|
8
|
+
lass Array
|
9
9
|
def collate(pattern=nil)
|
10
10
|
a = self.inject([[]]) do |r,x|
|
11
11
|
if block_given? then
|
@@ -24,10 +24,10 @@ class RowX
|
|
24
24
|
|
25
25
|
attr_reader :to_a, :to_xml
|
26
26
|
|
27
|
-
def initialize(txt)
|
27
|
+
def initialize(txt, level: nil)
|
28
|
+
|
29
|
+
a = LineTree.new(txt.gsub(/^-*$/m,''), level: level).to_a
|
28
30
|
|
29
|
-
a = LineTree.new(txt.gsub(/^-*$/m,'')).to_a
|
30
|
-
|
31
31
|
keyfield = a[0][0][/\w+/]; i = 0
|
32
32
|
|
33
33
|
while a.select {|x| x[0][/#{keyfield}/]}.length <= 1 and i < a.length
|
@@ -40,12 +40,13 @@ class RowX
|
|
40
40
|
summary = scan_a a.slice!(0,i)
|
41
41
|
|
42
42
|
summary[0] = 'summary'
|
43
|
-
@to_a = ['root', '', {}] + [summary] + scan_records(records)
|
43
|
+
@to_a = ['root', '', {}] + [summary] + scan_records(records, level)
|
44
44
|
@to_xml = Rexle.new(@to_a).xml pretty: true
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
48
|
private
|
49
|
+
|
49
50
|
|
50
51
|
def scan_a(row)
|
51
52
|
|
@@ -67,13 +68,10 @@ class RowX
|
|
67
68
|
['item', '', {}] + a
|
68
69
|
end
|
69
70
|
|
70
|
-
def scan_records(row)
|
71
|
+
def scan_records(row, level)
|
71
72
|
|
72
|
-
row.map
|
73
|
-
|
74
|
-
x.map! {|y| y.length <= 1 ? y : y.join("\n")}
|
75
|
-
scan_a x
|
76
|
-
end
|
73
|
+
row.map {|x| scan_a x }
|
74
|
+
|
77
75
|
end
|
78
76
|
|
79
77
|
end
|
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
yaP43m5g1gqUfr6ys6w86uiM1Khmw6RXdAZBrQU+jmXYRU0OejB3+MdhPte5gP6n
|
32
32
|
k3UhzyiVjlkLhQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-11-
|
34
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: line-tree
|
metadata.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
'��U/촡#p��<��;�����ץ��N��ӫ-y{���o�Od�}��'�y3���)�y��o��g������;U5�bS�opL�Q��%�[������r;q��� +��m&K��3�M�6C,�8yj���������G����$aԝa�kH�k9
|
2
|
+
>�b+l�
|