polyrex 0.8.32 → 0.8.33
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.rb +48 -2
- 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: 92235d2d1902a3c7102e6aa83415ef6787e02082
|
4
|
+
data.tar.gz: facb8e958cf9a0ffe7ae9394a3eb7206f05b9e4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78dd49747c22f4ab8b501c6dc0d70ff32f4b96b138f8caa4ee9ce60e971e8651aa475c5d7726d072f7e379f06ef870e7fd029fcf1f4cb2f45e275d4bb4ca2f1d
|
7
|
+
data.tar.gz: 863514cf1dddbd5b4d7b81090b188badb1423a9c228d0fa3e21403f18b714ac25109d34f6537b976bf4f6af9d30c534e29d17e39513db6c50db519bde6b93180
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/polyrex.rb
CHANGED
@@ -62,8 +62,13 @@ class Polyrex
|
|
62
62
|
@create
|
63
63
|
end
|
64
64
|
|
65
|
-
def delete(
|
66
|
-
|
65
|
+
def delete(x=nil)
|
66
|
+
|
67
|
+
if x.to_i.to_s == x.to_s then
|
68
|
+
@doc.root.delete("//[@id='#{x}'")
|
69
|
+
else
|
70
|
+
@doc.root.xpath(x).each(&:delete)
|
71
|
+
end
|
67
72
|
end
|
68
73
|
|
69
74
|
def delimiter=(separator)
|
@@ -143,6 +148,47 @@ class Polyrex
|
|
143
148
|
recordx_map @doc.root
|
144
149
|
end
|
145
150
|
|
151
|
+
def to_dynarex()
|
152
|
+
root = @doc.root.deep_clone
|
153
|
+
|
154
|
+
summary = root.element('summary')
|
155
|
+
e = summary.element('schema')
|
156
|
+
e.text = e.text[/[^\/]+\/[^\/]+/].sub(/(\/\w+)\[([^\]]+)\]/,'\1(\2)')
|
157
|
+
summary.delete('format_mask')
|
158
|
+
summary.element('recordx_type').text = 'dynarex'
|
159
|
+
|
160
|
+
summary.add root.element('records/*/summary/format_mask').clone
|
161
|
+
root.xpath('records/*/summary/format_mask').each(&:delete)
|
162
|
+
|
163
|
+
xsl_buffer =<<EOF
|
164
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
165
|
+
<xsl:output encoding="UTF-8"
|
166
|
+
indent="yes"
|
167
|
+
omit-xml-declaration="yes"/>
|
168
|
+
|
169
|
+
<xsl:template match="*">
|
170
|
+
<xsl:element name="{name()}">
|
171
|
+
<xsl:element name="summary">
|
172
|
+
<xsl:for-each select="summary/*">
|
173
|
+
<xsl:copy-of select="."/>
|
174
|
+
</xsl:for-each>
|
175
|
+
</xsl:element>
|
176
|
+
<xsl:element name="records">
|
177
|
+
<xsl:for-each select="records/*">
|
178
|
+
<xsl:element name="{name()}">
|
179
|
+
<xsl:copy-of select="summary/*"/>
|
180
|
+
</xsl:element>
|
181
|
+
</xsl:for-each>
|
182
|
+
</xsl:element>
|
183
|
+
</xsl:element>
|
184
|
+
</xsl:template>
|
185
|
+
</xsl:stylesheet>
|
186
|
+
EOF
|
187
|
+
xslt = Nokogiri::XSLT(xsl_buffer)
|
188
|
+
Dynarex.new xslt.transform(Nokogiri::XML(root.xml)).to_s
|
189
|
+
|
190
|
+
end
|
191
|
+
|
146
192
|
def to_xslt()
|
147
193
|
@polyrex_xslt.schema = @schema
|
148
194
|
@polyrex_xslt.to_xslt
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|