rowx 0.5.2 → 0.5.3
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 +14 -10
- metadata +2 -2
- 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: 2cebc3a1e2f709f929e4ce360b246f963026577a
|
4
|
+
data.tar.gz: a53a1527e32a11c97a724ddd2a1f00fcf2d728d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ba99a0d6234cf7071c8d4ffac46aff5a8ab778fbb059d16c7b706ab164c099af16470c6c5fcdb3568e028b2963804037e23377d301f1dcfb16f379387ec7f6e
|
7
|
+
data.tar.gz: c116ab24ed52844d89d8d46a7f90626d2bfb3c5b1644ac373ac6298baf60207554d12fef6b4b7ae77924c96475b739c6e57c5f2e28fb87b07ef3cd90cca38e00
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rowx.rb
CHANGED
@@ -37,19 +37,20 @@ class RowX
|
|
37
37
|
|
38
38
|
indent = ''
|
39
39
|
|
40
|
-
lines = txt.gsub(
|
40
|
+
lines = txt.gsub(/^-+$/m,'').lines.map do |line|
|
41
41
|
|
42
|
-
if not line[
|
42
|
+
if not line[/^\s*\w+:|^\s+/] then
|
43
43
|
indent + ' ' + line
|
44
44
|
else
|
45
45
|
indent = line[/^\s+/] || ''
|
46
46
|
line
|
47
47
|
end
|
48
48
|
|
49
|
-
end
|
50
|
-
|
49
|
+
end
|
50
|
+
|
51
51
|
a = LineTree.new(lines.join, level: level, ignore_blank_lines: false).to_a
|
52
|
-
|
52
|
+
|
53
|
+
|
53
54
|
keyfield = a[0][0][/\w+:/]; i = 0
|
54
55
|
|
55
56
|
# find the keyfield. if there's only 1 keyfield in all of the rows it's
|
@@ -66,6 +67,7 @@ class RowX
|
|
66
67
|
|
67
68
|
i = 0 if a.flatten(1).grep(/^#{keyfield}/).length == 1 # only 1 record
|
68
69
|
records = a[i..-1].collate { |x| x.first =~ /^#{keyfield }/ }
|
70
|
+
|
69
71
|
summary = scan_a a.slice!(0,i)
|
70
72
|
|
71
73
|
summary[0] = 'summary'
|
@@ -90,8 +92,10 @@ class RowX
|
|
90
92
|
s = field.is_a?(Array) ? field[0] : field
|
91
93
|
|
92
94
|
return if s.empty?
|
93
|
-
|
94
|
-
|
95
|
+
|
96
|
+
found = s.match(/^(\w+):\s*(.*)/m)
|
97
|
+
|
98
|
+
value, name = found ? found.captures.reverse : s
|
95
99
|
name ||= 'description'
|
96
100
|
|
97
101
|
children = scan_a(field[1..-1]) if field[-1] .is_a?(Array)
|
@@ -111,10 +115,10 @@ class RowX
|
|
111
115
|
['item', {}, '' ] + a
|
112
116
|
end
|
113
117
|
|
114
|
-
def scan_records(
|
118
|
+
def scan_records(rows, level)
|
115
119
|
|
116
|
-
|
120
|
+
rows.map {|x| scan_a x }
|
117
121
|
|
118
122
|
end
|
119
123
|
|
120
|
-
end
|
124
|
+
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.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
tTW+rjyuLX3NtJ5iyGmmz/CE0gX9kWF2/5wYZ/it0UG4W9z/7Rfdke4SD00FUWVB
|
32
32
|
VqXQja9F+5d+OA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-03-
|
34
|
+
date: 2017-03-05 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: line-tree
|
metadata.gz.sig
CHANGED
Binary file
|