rowx 0.5.2 → 0.5.3

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/rowx.rb +14 -10
  5. metadata +2 -2
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10d0489ab6c4aab281eec01a23b84e1e46460cef
4
- data.tar.gz: 164afbc00effb8ea28fc0a31d5c46f4c6f926574
3
+ metadata.gz: 2cebc3a1e2f709f929e4ce360b246f963026577a
4
+ data.tar.gz: a53a1527e32a11c97a724ddd2a1f00fcf2d728d0
5
5
  SHA512:
6
- metadata.gz: ce9ac34e3c09afe80905514ec7518ae9d6cd2b953eb19bb36bd4f4d32f82ea676ddf7bef85a5b23a7dc15618f66fe414e7fca5b0e601b376bb6a1520c66166d9
7
- data.tar.gz: 1d17ac9f1a3c463b41b4a8808c880ddee97c0b0cff0835d71b536b10528332c2a5c4029f8459801609da9af59cac898950c464c1b2ded5c090e37815d8178678
6
+ metadata.gz: 0ba99a0d6234cf7071c8d4ffac46aff5a8ab778fbb059d16c7b706ab164c099af16470c6c5fcdb3568e028b2963804037e23377d301f1dcfb16f379387ec7f6e
7
+ data.tar.gz: c116ab24ed52844d89d8d46a7f90626d2bfb3c5b1644ac373ac6298baf60207554d12fef6b4b7ae77924c96475b739c6e57c5f2e28fb87b07ef3cd90cca38e00
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -37,19 +37,20 @@ class RowX
37
37
 
38
38
  indent = ''
39
39
 
40
- lines = txt.gsub(/^-*$/m,'').lines.map do |line|
40
+ lines = txt.gsub(/^-+$/m,'').lines.map do |line|
41
41
 
42
- if not line[/\s*\w+:/] then
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
- value, name = s.split(':',2).reverse
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(row, level)
118
+ def scan_records(rows, level)
115
119
 
116
- row.map {|x| scan_a x }
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.2
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-04 00:00:00.000000000 Z
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