polyrex 0.8.21 → 0.8.22
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/polyrex.rb +15 -3
- metadata +2 -2
data/lib/polyrex.rb
CHANGED
@@ -11,6 +11,7 @@ require 'recordx-xslt'
|
|
11
11
|
require 'rexle'
|
12
12
|
require 'recordx'
|
13
13
|
require 'rxraw-lineparser'
|
14
|
+
require 'yaml'
|
14
15
|
|
15
16
|
module Enumerable
|
16
17
|
def repeated_permutation(size, &blk)
|
@@ -32,6 +33,7 @@ module Enumerable
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
36
|
+
|
35
37
|
class Polyrex
|
36
38
|
attr_accessor :summary_fields, :xslt_schema, :id_counter, :schema
|
37
39
|
|
@@ -231,7 +233,7 @@ class Polyrex
|
|
231
233
|
|
232
234
|
@summary.format_mask = @format_masks
|
233
235
|
|
234
|
-
format_line!(@parent_node.root, LineTree.new(raw_lines.join("\n").strip).to_a)
|
236
|
+
format_line!(@parent_node.element('summary'), @parent_node.root, LineTree.new(raw_lines.join("\n").strip).to_a)
|
235
237
|
|
236
238
|
end
|
237
239
|
|
@@ -246,7 +248,7 @@ class Polyrex
|
|
246
248
|
attach_edit_handlers(@objects)
|
247
249
|
end
|
248
250
|
|
249
|
-
def format_line!(records, a, i=0)
|
251
|
+
def format_line!(summary, records, a, i=0)
|
250
252
|
|
251
253
|
a.each do |x|
|
252
254
|
|
@@ -257,6 +259,16 @@ class Polyrex
|
|
257
259
|
|
258
260
|
tag_name = @recordx[i].to_s
|
259
261
|
line = x.shift
|
262
|
+
|
263
|
+
if line[/\w+\s*---/] then
|
264
|
+
|
265
|
+
yaml = YAML.load x.join("\n")
|
266
|
+
node_name = line.sub(/\s*---/,'')
|
267
|
+
ynode = Rexle::Element.new(node_name).add_text("---\n" + x.join("\n"))
|
268
|
+
|
269
|
+
summary.add ynode
|
270
|
+
next
|
271
|
+
end
|
260
272
|
|
261
273
|
unless @format_masks[i][/^\(.*\)$/] then
|
262
274
|
|
@@ -299,7 +311,7 @@ class Polyrex
|
|
299
311
|
record.add new_records
|
300
312
|
records.add record
|
301
313
|
|
302
|
-
format_line!(new_records, x, i+1) unless x.empty?
|
314
|
+
format_line!(summary, new_records, x, i+1) unless x.empty?
|
303
315
|
end
|
304
316
|
end
|
305
317
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: polyrex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.22
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- James Robertson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-07-27 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: polyrex-schema
|