rowx 0.7.3 → 0.7.4
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 -8
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 117e67e111222ae3340f55869da655ee10e6e94f538cef074d70a977f58f522d
|
4
|
+
data.tar.gz: c89eb4d40e0df4f8aea3dbb7214979365f23fd9dfb146e8b961f391863d36c17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4e1b9ee7c969e217846bc6d9a1e6c896659915e10ff2aaa631b3db1c28d14def8ed2e138ca1701b86fc8cd3246e9dc0b8c73647bf6f0263a9c4f176934022f5
|
7
|
+
data.tar.gz: f7ac382605f8662528d1e27b2936ac7530dec4e96ef852a51435e70dc48b1327fa064c4d9bd868436057d9deb3ca6edacaadfe53794ec1eac3d60310dbbfe318
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rowx.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
72
|
-
keyfield
|
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.
|
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-
|
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
|