rowx 0.7.3 → 0.7.4

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
  SHA256:
3
- metadata.gz: 1105fda5cd1829ebba2275b56a3b04937d5e4c0db109f113a40c2162e106a1e1
4
- data.tar.gz: 72874acc3709cd44d95a43078fbc93db94934ba876fd9376aced5b3124fa7e55
3
+ metadata.gz: 117e67e111222ae3340f55869da655ee10e6e94f538cef074d70a977f58f522d
4
+ data.tar.gz: c89eb4d40e0df4f8aea3dbb7214979365f23fd9dfb146e8b961f391863d36c17
5
5
  SHA512:
6
- metadata.gz: 1bedd7f84e21df706e34a2da9c14bdc8f098930d9f00fa8355390111b76d7a26ea232bfdb036646e6e049ce05c6e972ea97a821be05e60b881b56230e2b7b456
7
- data.tar.gz: 1e64d2a2d93cfb5976abdacbea272cb3cc7c52110d2a56a7fcad488a7ad818a8120fba021cae272d06185722d68202f928e5dafa7338fd089941d97046b14121
6
+ metadata.gz: d4e1b9ee7c969e217846bc6d9a1e6c896659915e10ff2aaa631b3db1c28d14def8ed2e138ca1701b86fc8cd3246e9dc0b8c73647bf6f0263a9c4f176934022f5
7
+ data.tar.gz: f7ac382605f8662528d1e27b2936ac7530dec4e96ef852a51435e70dc48b1327fa064c4d9bd868436057d9deb3ca6edacaadfe53794ec1eac3d60310dbbfe318
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -36,7 +36,8 @@ class RowX
36
36
  attr_reader :to_a, :to_xml, :to_lines
37
37
 
38
38
  def initialize(txt, level: nil, ignore_blank_lines: false,
39
- abort_1_row: false, debug: false, name: 'item')
39
+ abort_1_row: false, debug: false, name: 'item',
40
+ allow_lonely_keyfield: false)
40
41
 
41
42
  @name, @debug = name, debug
42
43
 
@@ -62,17 +63,22 @@ class RowX
62
63
  puts ('a: ' + a.inspect).debug if @debug
63
64
 
64
65
  keyfield = a[0][0][/\w+:/]; i = 0
66
+ puts ('keyfield: ' + keyfield.inspect).debug if @debug
65
67
 
66
- # find the keyfield. if there's only 1 keyfield in all of the rows it's
67
- # not a keyfield. Keep searching until all rows have been searched
68
- while a.select {|x| x[0][/^#{keyfield}/]}.length <= 1 and \
69
- i < a.length and a[i+1]
68
+ if not allow_lonely_keyfield then
70
69
 
71
- i += 1
72
- keyfield = a[i][0][/\w+/]
70
+ # find the keyfield. if there's only 1 keyfield in all of the rows it's
71
+ # not a keyfield. Keep searching until all rows have been searched
72
+ while a.select {|x| x[0][/^#{keyfield}/]}.length <= 1 and \
73
+ i < a.length and a[i+1]
74
+
75
+ i += 1
76
+ keyfield = a[i][0][/\w+/]
73
77
 
78
+ end
79
+
74
80
  end
75
-
81
+
76
82
  keyfield = a[0][0][/\w+/] if i == a.length - 1
77
83
 
78
84
  if a.flatten(1).grep(/^#{keyfield}/).length == 1 then # only 1 record
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.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  800/1OqpheFJ2kxsgvkGfxh/3RV+ObACeZ/HSFCxStB23EvqS8umVWDkXA3qr3RB
36
36
  yuZ4lODk6vzJbiDVh0MAHLnZ
37
37
  -----END CERTIFICATE-----
38
- date: 2020-10-02 00:00:00.000000000 Z
38
+ date: 2020-10-04 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: line-tree
metadata.gz.sig CHANGED
Binary file