polyrex 0.8.33 → 0.8.34
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/polyrex.rb +31 -5
- data.tar.gz.sig +0 -0
- 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: f22bfea02d697da5897d487fe3174e92b1505f9f
|
4
|
+
data.tar.gz: e2381385c4388dc4c40e612d219aa15b38a9a97d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37f84775b83c3fc0c4d9e0a6056b9764adb3525f888eaaa8199cc74e7e9f15435dd4a7fdf9b1131938d0d703ab58259d6b5b899075b79bde81e319ce5fc93dbf
|
7
|
+
data.tar.gz: e62a494eff2b7e6a6a12544d3974e5a4176e7f2458e0a5521449c227b8792569a62ce83b37bc2a7cf15e7bb521f862fc1a3900c6f149fa0aafd9cee4b628b9e1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/polyrex.rb
CHANGED
@@ -39,12 +39,21 @@ end
|
|
39
39
|
class Polyrex
|
40
40
|
attr_accessor :summary_fields, :xslt_schema, :id_counter, :schema, :type
|
41
41
|
|
42
|
-
def initialize(location=nil,
|
42
|
+
def initialize(location=nil, opt={})
|
43
43
|
|
44
|
-
|
44
|
+
options = {id_counter: '1'}.merge opt
|
45
|
+
@id_counter = options[:id_counter]
|
45
46
|
|
46
47
|
if location then
|
48
|
+
self.method(:schema=).call(options[:schema]) if options[:schema]
|
47
49
|
open(location)
|
50
|
+
|
51
|
+
if options[:schema] then
|
52
|
+
fields = @schema[/\/.*/].scan(/\[([^\]]+)/).map \
|
53
|
+
{|x| x.first.split(',').map(&:strip)}
|
54
|
+
refresh_records self.records, fields, 0
|
55
|
+
end
|
56
|
+
|
48
57
|
summary_h = Hash[*@doc.root.xpath("summary/*").map {|x| [x.name, x.text]}.flatten]
|
49
58
|
#@summary = OpenStruct.new summary_h
|
50
59
|
@summary = RecordX.new summary_h
|
@@ -185,7 +194,8 @@ xsl_buffer =<<EOF
|
|
185
194
|
</xsl:stylesheet>
|
186
195
|
EOF
|
187
196
|
xslt = Nokogiri::XSLT(xsl_buffer)
|
188
|
-
|
197
|
+
buffer = xslt.transform(Nokogiri::XML(root.xml)).to_s
|
198
|
+
Dynarex.new buffer
|
189
199
|
|
190
200
|
end
|
191
201
|
|
@@ -210,6 +220,20 @@ EOF
|
|
210
220
|
|
211
221
|
private
|
212
222
|
|
223
|
+
def refresh_records(records, fields, level)
|
224
|
+
|
225
|
+
records.each do |record|
|
226
|
+
|
227
|
+
level -= 1 unless fields[level]
|
228
|
+
fields[level].each {|x| record.method(x).call }
|
229
|
+
|
230
|
+
if record.records.any? then
|
231
|
+
refresh_records record.records, fields, level+1
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
213
237
|
def polyrex_new(schema)
|
214
238
|
# -- required for the parsing feature
|
215
239
|
doc = PolyrexSchema.new(schema).to_doc
|
@@ -446,10 +470,12 @@ EOF
|
|
446
470
|
@local_filepath = s
|
447
471
|
end
|
448
472
|
|
449
|
-
@
|
473
|
+
buffer.gsub!(/<schema>[^<]+/, '<schema>' + @schema) if @schema
|
450
474
|
|
451
|
-
|
475
|
+
@doc = Rexle.new buffer
|
452
476
|
|
477
|
+
schema = @doc.root.text('summary/schema')
|
478
|
+
|
453
479
|
unless @format_masks
|
454
480
|
schema_rpath = schema.gsub(/\[[^\]]+\]/,'')
|
455
481
|
@recordx = schema_rpath.split('/')
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyrex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
7hfiCsNv+0o/OwBNlpn8pTTpd3jV6o1Qq0Y7QiFomKd6XWlaHT4ZNtZdb/XTpC7W
|
30
30
|
ZUZv+oXV5L4FrLlOrnTUhA+cZRntSyHs
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-09-
|
32
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: polyrex-schema
|
metadata.gz.sig
CHANGED
Binary file
|