polyrex-objects 0.7.9 → 0.7.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/polyrex-objects.rb +46 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: 72f503d7863321fe795d5b313cb6e419fb8d2e86
|
4
|
+
data.tar.gz: d58c45be59880853f71c6b7483313c0a1cd810de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b80d4d432164e99dad3679fe1917b44157bf83f6e287952635d5132895ab894e6da1171ef0da6954666c059316723add45938cdc01e5ab2141ca127ca6958e2
|
7
|
+
data.tar.gz: bc0aa1579047a5758af253968c206b936e93f0c906a6f50a754777b1d878798d957e7c193aafdb05e0a178c06086f38c8a28ff8ebfbae6a4b20d5358fe3a8123
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/polyrex-objects.rb
CHANGED
@@ -65,6 +65,52 @@ class PolyrexObjects
|
|
65
65
|
self.records[n]
|
66
66
|
end
|
67
67
|
|
68
|
+
def to_dynarex()
|
69
|
+
|
70
|
+
root = Rexle.new(self.to_xml).root
|
71
|
+
|
72
|
+
summary = root.element('summary')
|
73
|
+
e = summary.element('schema')
|
74
|
+
child_schema = root.element('records/*/summary/schema/text()')\
|
75
|
+
.sub('[','(').sub(']',')')
|
76
|
+
e.text = "%s/%s" % [e.text, child_schema]
|
77
|
+
summary.delete('format_mask')
|
78
|
+
summary.element('recordx_type').text = 'dynarex'
|
79
|
+
|
80
|
+
summary.add root.element('records/*/summary/format_mask').clone
|
81
|
+
root.xpath('records/*/summary/format_mask').each(&:delete)
|
82
|
+
|
83
|
+
xsl_buffer =<<EOF
|
84
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
85
|
+
<xsl:output encoding="UTF-8"
|
86
|
+
indent="yes"
|
87
|
+
omit-xml-declaration="yes"/>
|
88
|
+
|
89
|
+
<xsl:template match="*">
|
90
|
+
<xsl:element name="{name()}">
|
91
|
+
<xsl:element name="summary">
|
92
|
+
<xsl:for-each select="summary/*">
|
93
|
+
<xsl:copy-of select="."/>
|
94
|
+
</xsl:for-each>
|
95
|
+
</xsl:element>
|
96
|
+
<xsl:element name="records">
|
97
|
+
<xsl:for-each select="records/*">
|
98
|
+
<xsl:element name="{name()}">
|
99
|
+
<xsl:copy-of select="summary/*"/>
|
100
|
+
</xsl:element>
|
101
|
+
</xsl:for-each>
|
102
|
+
</xsl:element>
|
103
|
+
</xsl:element>
|
104
|
+
</xsl:template>
|
105
|
+
</xsl:stylesheet>
|
106
|
+
EOF
|
107
|
+
xslt = Nokogiri::XSLT(xsl_buffer)
|
108
|
+
buffer = xslt.transform(Nokogiri::XML(root.xml)).to_s
|
109
|
+
Dynarex.new buffer
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
|
68
114
|
def to_h()
|
69
115
|
@fields.inject({}) do |r, field|
|
70
116
|
r.merge(field.capitalize => self.method(field).call)
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|