rowx 0.5.4 → 0.6.0

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: fb0bb50bccd3eaa034e7167d59d0fc239ec688ee
4
- data.tar.gz: 73d3b1d51b278d60a8d0f80e1da9033951b9a96e
3
+ metadata.gz: c98d55480e2c1881ea9bbba3a02a8d3955ea923c
4
+ data.tar.gz: cf37cbdd69dc054aca697d0ee8a7439f9ffc6fc6
5
5
  SHA512:
6
- metadata.gz: c543a16cd5a8b2b7662f8488fc2b36ae603644540e2d875f69147d04389cb7038132fd8dedecba1e9f51f850e54e24ffe29e54566eb60c9b8da9a640bfe90688
7
- data.tar.gz: 6bfa79d8da64b6d64d415f76dec9160f3687b00c3f1131b03863f880b63f7079656363b0db91ddcaebe7a18e9232b5534975e4146affe25647a04d1596f65ae7
6
+ metadata.gz: f023f8b760eea3396f9fd0ecdf9a3347fecd8139842d109f4be8ea3456ab81db76483144284d671b9554ec04e30f61ac633468d21c5362958f197c5f96aa64dd
7
+ data.tar.gz: cdc5d79e8041f3763c878c00ba84f229732287fb07d5576ef0566834478fb1d9912d089f1805f4f4479ce957bf90dd0b8716f785aabb6198397c7ad137dca922
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -5,6 +5,9 @@
5
5
  require 'line-tree'
6
6
 
7
7
 
8
+ class RowXException < Exception
9
+ end
10
+
8
11
  # for an example of ArrayCollate
9
12
  # see http://www.jamesrobertson.eu/snippets/2014/jun/08/collating-items-in-an-array.html
10
13
 
@@ -31,7 +34,8 @@ class RowX
31
34
 
32
35
  attr_reader :to_a, :to_xml, :to_lines
33
36
 
34
- def initialize(txt, level: nil)
37
+ def initialize(txt, level: nil, ignore_blank_lines: false,
38
+ abort_1_row: false)
35
39
 
36
40
  # auto indent any multiline values
37
41
 
@@ -48,7 +52,8 @@ class RowX
48
52
 
49
53
  end
50
54
 
51
- a = LineTree.new(lines.join, level: level, ignore_blank_lines: false).to_a
55
+ a = LineTree.new(lines.join, level: level,
56
+ ignore_blank_lines: ignore_blank_lines).to_a
52
57
 
53
58
 
54
59
  keyfield = a[0][0][/\w+:/]; i = 0
@@ -65,11 +70,14 @@ class RowX
65
70
 
66
71
  keyfield = a[0][0][/\w+/] if i == a.length - 1
67
72
 
68
- i = 0 if a.flatten(1).grep(/^#{keyfield}/).length == 1 # only 1 record
73
+ if a.flatten(1).grep(/^#{keyfield}/).length == 1 then # only 1 record
74
+ i = 0
75
+ raise RowXException, 'Expected more than 1 row' if abort_1_row
76
+ end
77
+
69
78
  records = a[i..-1].collate { |x| x.first =~ /^#{keyfield }/ }
70
79
 
71
80
  summary = scan_a a.slice!(0,i)
72
-
73
81
  summary[0] = 'summary'
74
82
 
75
83
  @rexle_a = scan_records(records, level)
@@ -121,4 +129,4 @@ class RowX
121
129
 
122
130
  end
123
131
 
124
- end
132
+ 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
4
+ version: 0.6.0
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-05 00:00:00.000000000 Z
34
+ date: 2017-09-07 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: line-tree
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '0.5'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.5.6
45
+ version: 0.5.8
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  version: '0.5'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.5.6
55
+ version: 0.5.8
56
56
  description: Generates XML from rows of labelled text, nested text, and plain text
57
57
  email: james@jamesrobertson.eu
58
58
  executables: []
metadata.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- ��Vhc
2
-
3
- �:�^֚sr�T��9��b�ώ��5���Vb�Rb��f��h�IH��Q�F�$C[-�<f
4
- ]P!,$�#@s=pv����Sb�����]/�Y�1�
1
+ J�m����8���d�}Hdl���&�;m€F��Ec��N[_�`���bu��f�~������iU���y��7�Pך���=?����M���Wa/^{A���X�+w2f[Q���nyJ^8�>K�e9����`8�]�:��)\=����~O��
2
+ X����YFVL\�~QU7��1�8Y��Sɠ���)1傹P�Hۿ� ����C��9��-����1��ܿ�i��̨�>^|V�����RUr�����I-��������