polyrex 1.0.5 → 1.0.6
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 +1 -2
- data.tar.gz.sig +0 -0
- data/lib/polyrex.rb +63 -32
- metadata +2 -2
- metadata.gz.sig +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c63dd0f72de75a539790a4adaf6b9b9eb6776f6
|
4
|
+
data.tar.gz: d9e92aa15830806e4a2c8ee29b2246e4ef57ebca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a85bd7fbbcad9e15158743b72617f55e818efa0d1d647a2eba1f0667b8e143df84589b0a054999b67248da0521d7a8684f8bb577b3089a6b455276e10e369a7
|
7
|
+
data.tar.gz: 4540b5fec77eef955a2da76c1c10e83b3cf7f10ce8541bd1fd4bb730ef81ce7e1f92e1a1063f22c5c5dbaf1a5e39d227de5818e1bca9f53b7ecb3a1b2986bec9
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
dm}
|
1
|
+
�H��u��>��l�[�֩�*m�c���l~���V��H�[v�����Wu�jm#�g��T/I��(R�����>N��w��!C��'��W<��;Rսv���yd�>zӪ/U���/�m[��/)v`H}���V��c��u)w�\kݾ����(aV���l���$[j�'㔣�8W���O���3d��w.Ty,w�8T�9n�7����F[�b�������)�1��*��,��L,��k�L?y��:T/z5
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/polyrex.rb
CHANGED
@@ -156,6 +156,31 @@ class Polyrex
|
|
156
156
|
@doc.root.element(s)
|
157
157
|
end
|
158
158
|
|
159
|
+
def leaf_nodes_to_dx()
|
160
|
+
|
161
|
+
schema, record_name = @summary.schema\
|
162
|
+
.match(/([^\/]+\/([^\/]+)\[[^\[]+$)/).captures
|
163
|
+
|
164
|
+
xml = RexleBuilder.new
|
165
|
+
|
166
|
+
xml.items do
|
167
|
+
xml.summary do
|
168
|
+
xml.schema schema.sub(/(\/\w+)\[([^\]]+)\]/,'\1(\2)')
|
169
|
+
end
|
170
|
+
xml.records
|
171
|
+
end
|
172
|
+
|
173
|
+
doc = Rexle.new xml.to_a
|
174
|
+
body = doc.root.element 'records'
|
175
|
+
a = self.xpath('//' + record_name)
|
176
|
+
|
177
|
+
a.each do |record|
|
178
|
+
body.add record.deep_clone
|
179
|
+
end
|
180
|
+
|
181
|
+
make_dynarex doc.root
|
182
|
+
end
|
183
|
+
|
159
184
|
def records
|
160
185
|
@doc.root.xpath("records/*").map do |record|
|
161
186
|
@objects_a[0].new(record)
|
@@ -194,42 +219,14 @@ class Polyrex
|
|
194
219
|
root = @doc.root.deep_clone
|
195
220
|
|
196
221
|
summary = root.element('summary')
|
197
|
-
e = summary.element('schema')
|
198
|
-
e.text = e.text[/[^\/]+\/[^\/]+/].sub(/(\/\w+)\[([^\]]+)\]/,'\1(\2)')
|
199
222
|
summary.delete('format_mask')
|
200
223
|
summary.element('recordx_type').text = 'dynarex'
|
201
224
|
|
202
|
-
summary.add root.element('records/*/summary/format_mask').clone
|
203
|
-
|
204
|
-
|
205
|
-
xsl_buffer =<<EOF
|
206
|
-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
207
|
-
<xsl:output encoding="UTF-8"
|
208
|
-
indent="yes"
|
209
|
-
omit-xml-declaration="yes"/>
|
210
|
-
|
211
|
-
<xsl:template match="*">
|
212
|
-
<xsl:element name="{name()}">
|
213
|
-
<xsl:element name="summary">
|
214
|
-
<xsl:for-each select="summary/*">
|
215
|
-
<xsl:copy-of select="."/>
|
216
|
-
</xsl:for-each>
|
217
|
-
</xsl:element>
|
218
|
-
<xsl:element name="records">
|
219
|
-
<xsl:for-each select="records/*">
|
220
|
-
<xsl:element name="{name()}">
|
221
|
-
<xsl:copy-of select="summary/*"/>
|
222
|
-
</xsl:element>
|
223
|
-
</xsl:for-each>
|
224
|
-
</xsl:element>
|
225
|
-
</xsl:element>
|
226
|
-
</xsl:template>
|
227
|
-
</xsl:stylesheet>
|
228
|
-
EOF
|
229
|
-
xslt = Nokogiri::XSLT(xsl_buffer)
|
230
|
-
buffer = xslt.transform(Nokogiri::XML(root.xml)).to_s
|
231
|
-
Dynarex.new buffer
|
225
|
+
summary.add root.element('records/*/summary/format_mask').clone
|
226
|
+
e = summary.element('schema')
|
227
|
+
e.text = e.text[/[^\/]+\/[^\/]+/].sub(/(\/\w+)\[([^\]]+)\]/,'\1(\2)')
|
232
228
|
|
229
|
+
make_dynarex(root)
|
233
230
|
end
|
234
231
|
|
235
232
|
def to_s()
|
@@ -305,6 +302,40 @@ EOF
|
|
305
302
|
end
|
306
303
|
|
307
304
|
private
|
305
|
+
|
306
|
+
def make_dynarex(root)
|
307
|
+
|
308
|
+
|
309
|
+
root.xpath('records/*/summary/format_mask').each(&:delete)
|
310
|
+
|
311
|
+
xsl_buffer =<<EOF
|
312
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
313
|
+
<xsl:output encoding="UTF-8"
|
314
|
+
indent="yes"
|
315
|
+
omit-xml-declaration="yes"/>
|
316
|
+
|
317
|
+
<xsl:template match="*">
|
318
|
+
<xsl:element name="{name()}">
|
319
|
+
<xsl:element name="summary">
|
320
|
+
<xsl:for-each select="summary/*">
|
321
|
+
<xsl:copy-of select="."/>
|
322
|
+
</xsl:for-each>
|
323
|
+
</xsl:element>
|
324
|
+
<xsl:element name="records">
|
325
|
+
<xsl:for-each select="records/*">
|
326
|
+
<xsl:element name="{name()}">
|
327
|
+
<xsl:copy-of select="summary/*"/>
|
328
|
+
</xsl:element>
|
329
|
+
</xsl:for-each>
|
330
|
+
</xsl:element>
|
331
|
+
</xsl:element>
|
332
|
+
</xsl:template>
|
333
|
+
</xsl:stylesheet>
|
334
|
+
EOF
|
335
|
+
xslt = Nokogiri::XSLT(xsl_buffer)
|
336
|
+
buffer = xslt.transform(Nokogiri::XML(root.xml)).to_s
|
337
|
+
Dynarex.new buffer
|
338
|
+
end
|
308
339
|
|
309
340
|
def refresh_records(records, fields, level)
|
310
341
|
|
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: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
xutogBWBRwktcdg7bc24/mbFcXcx5WhspVwfj6isE6q3A1nNkMtk3DHHKmUrfemr
|
32
32
|
pWpTJQi2DFAx/g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-03-
|
34
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: polyrex-schema
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
����� ����� o��������m�O�ߔ��
|
1
|
+
�E&�[�v�1m=�?������ί뽒��<���,'�
|
2
|
+
�Uɡ���0��/��C�~K1�Z����291�D�P�KXR�:�2�8�T$S �]|�X{M�9<ti@:4�g�M1n�pL*h���]�&;��lq���ȷ3����9��P8����=�Cp:\���&U{MT'L�����jDD���Ԣ����<��J�V��r�+W��Xx"X�>���o���L'�c��zS���
|