lineparser 0.1.18 → 0.1.19
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 +2 -2
- data/lib/lineparser.rb +30 -8
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26d86d9aefef101369b87b0c27585a77db31e97c
|
4
|
+
data.tar.gz: d008c9537387e4c5dd8fa5d98670526fb46bd21d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d89adecd25a597dfcb516f4635919cce3af2458da8f7094ef566ec799ac3b2e6c8bb08807f0456852be45e77d154428c3dde70014c733ce27c1312925bd24bdb
|
7
|
+
data.tar.gz: 57e5d7d3302d0e7b9150107251a79d04a4fb6df19398d86d6538fd24dce7a871eac7ec6550661d24cc9212f0e90c871a8283f3fe7187ddc23f0aae3367d01dbf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
5�.x�
|
2
|
+
��wA�������3휵h,a= ْ�M��gj¼�:��\ȃ�'̾9R ��9O�f�Ϲ FI������'��[�o��j�w�O�I���;�9�����H�74'��<
|
data/lib/lineparser.rb
CHANGED
@@ -51,10 +51,11 @@ class LineParser
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def parse(s)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
@a
|
54
|
+
|
55
|
+
puts 'inside parse()' if @debug
|
56
|
+
a = scan @tree_patterns, LineTree.new(s, ignore_blank_lines: @ibl).to_a
|
57
|
+
@h2 = build_hash a
|
58
|
+
@a = a
|
58
59
|
|
59
60
|
end
|
60
61
|
|
@@ -63,7 +64,7 @@ class LineParser
|
|
63
64
|
end
|
64
65
|
|
65
66
|
def to_h()
|
66
|
-
@
|
67
|
+
@h2
|
67
68
|
end
|
68
69
|
|
69
70
|
def to_xml
|
@@ -88,6 +89,9 @@ class LineParser
|
|
88
89
|
|
89
90
|
a2 = []
|
90
91
|
|
92
|
+
puts 'row: ' + row.inspect
|
93
|
+
puts 'row[3]: ' + row[3].inspect
|
94
|
+
|
91
95
|
if row[3] and row[3].any? then
|
92
96
|
|
93
97
|
puts 'row[3][0][1]: ' + row[3][0][1].inspect if @debug
|
@@ -104,7 +108,8 @@ class LineParser
|
|
104
108
|
a2 = row[1].values.first
|
105
109
|
end
|
106
110
|
|
107
|
-
key = row[1].values.first
|
111
|
+
key = row[1].values.first
|
112
|
+
key ||= a2
|
108
113
|
(key.empty? or key == a2) ? a2 : {key => a2}
|
109
114
|
|
110
115
|
end
|
@@ -120,7 +125,7 @@ class LineParser
|
|
120
125
|
|
121
126
|
filter(h3)
|
122
127
|
|
123
|
-
end
|
128
|
+
end
|
124
129
|
|
125
130
|
def join(lines, indent='')
|
126
131
|
lines.map do |x|
|
@@ -129,6 +134,8 @@ class LineParser
|
|
129
134
|
end
|
130
135
|
|
131
136
|
def scan(xpatterns, items)
|
137
|
+
|
138
|
+
puts 'inside scan()' if @debug
|
132
139
|
|
133
140
|
records = []
|
134
141
|
|
@@ -143,6 +150,8 @@ class LineParser
|
|
143
150
|
found = @patterns.detect do |_, pattern|
|
144
151
|
params = @h[pattern.class.to_s.to_sym].call x.first, pattern
|
145
152
|
end
|
153
|
+
|
154
|
+
puts 'found: ' + found.inspect if @debug
|
146
155
|
|
147
156
|
if found then
|
148
157
|
|
@@ -152,7 +161,11 @@ class LineParser
|
|
152
161
|
|
153
162
|
else
|
154
163
|
|
164
|
+
puts 'xpatterns: ' + xpatterns.inspect if @debug
|
165
|
+
|
155
166
|
found = xpatterns.detect do |_, pattern, id|
|
167
|
+
|
168
|
+
puts 'found2: ' + found.inspect if @debug
|
156
169
|
|
157
170
|
if pattern == :root then
|
158
171
|
|
@@ -160,10 +173,19 @@ class LineParser
|
|
160
173
|
params = @h[pattern2.class.to_s.to_sym].call x.first, pattern2
|
161
174
|
context = id if params
|
162
175
|
end
|
163
|
-
|
176
|
+
|
177
|
+
puts 'found3: ' + found.inspect if @debug
|
178
|
+
|
164
179
|
else
|
165
180
|
|
181
|
+
if @debug then
|
182
|
+
puts '@h: ' + @h.inspect
|
183
|
+
puts 'pattern: ' + pattern.inspect
|
184
|
+
puts 'x.first: ' + x.first.inspect
|
185
|
+
end
|
186
|
+
|
166
187
|
params = @h[pattern.class.to_s.to_sym].call x.first, pattern
|
188
|
+
puts 'params: ' + params.inspect if @debug
|
167
189
|
context = id if params
|
168
190
|
end
|
169
191
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lineparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
7CkP6/pzsGLnyfCNF6rkXny4G0mjMmALczbazUUCil4IJNYfvW28Nlm2cD1N6Y/t
|
31
31
|
Uck=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-06-
|
33
|
+
date: 2018-06-29 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: line-tree
|
metadata.gz.sig
CHANGED
Binary file
|