polyrex 0.8.15 → 0.8.16
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/polyrex.rb +16 -3
- metadata +1 -1
data/lib/polyrex.rb
CHANGED
@@ -174,9 +174,9 @@ class Polyrex
|
|
174
174
|
[fields, a]
|
175
175
|
end
|
176
176
|
|
177
|
-
def string_parse(
|
177
|
+
def string_parse(buffer)
|
178
178
|
|
179
|
-
raw_header =
|
179
|
+
raw_header = buffer.slice!(/<\?polyrex[^>]+>/)
|
180
180
|
|
181
181
|
if raw_header then
|
182
182
|
header = raw_header[/<?polyrex (.*)?>/,1]
|
@@ -185,8 +185,21 @@ class Polyrex
|
|
185
185
|
self.method(name).call(value)
|
186
186
|
end
|
187
187
|
end
|
188
|
+
|
189
|
+
raw_summary = schema[/\[([^\]]+)/,1]
|
190
|
+
raw_lines = buffer.strip.split(/\r?\n|\r(?!\n)/)
|
191
|
+
|
192
|
+
if raw_summary then
|
193
|
+
a_summary = raw_summary.split(',').map(&:strip)
|
194
|
+
|
195
|
+
while raw_lines.first[/#{a_summary.join('|')}:\s+\w+/] do
|
196
|
+
label, val = raw_lines.shift.match(/(\w+):\s+([^$]+)$/).captures
|
197
|
+
@summary.send (label + '=').to_sym, val
|
198
|
+
end
|
199
|
+
end
|
188
200
|
|
189
|
-
|
201
|
+
@summary.format_mask = @format_mask
|
202
|
+
format_line!(@parent_node.root, LineTree.new(raw_lines.join("\n").strip).to_a)
|
190
203
|
end
|
191
204
|
|
192
205
|
def load_handlers(schema)
|