rowx 0.3.1 → 0.4.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: e5192e7ed6e792d708cec04112252205c9b1bbd3
4
- data.tar.gz: 6d1eb2fd146c22599436add0318d01332a22c5e9
3
+ metadata.gz: 966d3405e30f74f4e5573192ed59d29be655c634
4
+ data.tar.gz: e5c9bb2c81f11f9e8a8d99b39d11bee7efe9e52d
5
5
  SHA512:
6
- metadata.gz: 87399315019fd8e5157299609220e6a069bcbc730151d168be39e6ba898adbb3e1ae0d73f0edea4a79f598274e2ff82f9b9de280b657fe0b35d1146a08156f65
7
- data.tar.gz: 85ac2bea5fb02442ce5b870b7acabfa60af725eb481733352f85b99750baeb8ae69c7b17cf995d1f50e5d1c7e3c3965855b5df6784827006969ad10beefd2c48
6
+ metadata.gz: 989b35a675a4e8179a56bf86f96a79fd9675b96a0909a1dee25b38057567f4d8b7e6c3806fd1a17395f68d19cc4b2169b0cd150fa4d56c07657d29a485a205da
7
+ data.tar.gz: d52412e7ebe964a040fbb1d236009e936bcc62a625fba1b09a68db0b4e1c94f88bbd490898d9c04039e9f406313b107ec1946882a5a5d5e33d29fc6260b58e4c
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/rowx.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # file: rowx.rb
4
4
 
5
5
  require 'line-tree'
6
- require 'rexle'
6
+
7
7
 
8
8
  class Array
9
9
  def collate(pattern=nil)
@@ -26,10 +26,11 @@ class RowX
26
26
 
27
27
  def initialize(txt, level: nil)
28
28
 
29
- a = LineTree.new(txt.gsub(/^-*$/m,''), level: level).to_a
30
-
29
+ a = LineTree.new(txt.gsub(/^-*$/m,''), level: level, ignore_blank_lines: false).to_a
31
30
  keyfield = a[0][0][/\w+:/]; i = 0
32
31
 
32
+ # find the keyfield. if there's only 1 keyfield in all of the rows it's
33
+ # not a keyfield. Keep searching until all rows have been searched
33
34
  while a.select {|x| x[0][/^#{keyfield}/]}.length <= 1 and i < a.length
34
35
  i += 1
35
36
  keyfield = a[i][0][/\w+/]
@@ -54,6 +55,9 @@ class RowX
54
55
  a = row.map do |field|
55
56
 
56
57
  s = field.is_a?(Array) ? field[0] : field
58
+
59
+ return if s.empty?
60
+
57
61
  value, name = s.split(':',2).reverse
58
62
  name ||= 'description'
59
63
 
@@ -74,4 +78,4 @@ class RowX
74
78
 
75
79
  end
76
80
 
77
- end
81
+ 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.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  yaP43m5g1gqUfr6ys6w86uiM1Khmw6RXdAZBrQU+jmXYRU0OejB3+MdhPte5gP6n
32
32
  k3UhzyiVjlkLhQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-02-02 00:00:00.000000000 Z
34
+ date: 2015-03-02 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.0
45
+ version: 0.5.3
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,27 +52,7 @@ dependencies:
52
52
  version: '0.5'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.5.0
56
- - !ruby/object:Gem::Dependency
57
- name: rexle
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '1.2'
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: 1.2.0
66
- type: :runtime
67
- prerelease: false
68
- version_requirements: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '1.2'
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 1.2.0
55
+ version: 0.5.3
76
56
  description: Generates XML from rows of labelled, nested, and plain text
77
57
  email: james@r0bertson.co.uk
78
58
  executables: []
metadata.gz.sig CHANGED
Binary file