polyrex 0.8.15 → 0.8.16

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.
Files changed (2) hide show
  1. data/lib/polyrex.rb +16 -3
  2. metadata +1 -1
@@ -174,9 +174,9 @@ class Polyrex
174
174
  [fields, a]
175
175
  end
176
176
 
177
- def string_parse(lines)
177
+ def string_parse(buffer)
178
178
 
179
- raw_header = lines.slice!(/<\?polyrex[^>]+>/)
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
- format_line!(@parent_node.root, LineTree.new(lines.strip).to_a)
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)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: polyrex
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.15
5
+ version: 0.8.16
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson