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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d0dcaaa7face1a30aa59e2e7b7323f68aceb839
4
- data.tar.gz: 5f2f10b836a0de894a3ad6def0c23e0a702c5ecd
3
+ metadata.gz: 72f503d7863321fe795d5b313cb6e419fb8d2e86
4
+ data.tar.gz: d58c45be59880853f71c6b7483313c0a1cd810de
5
5
  SHA512:
6
- metadata.gz: 5460f0fbbda820e2ca9dd8836c88495359cdcfb17298e42ac67d9584cafd03fb8cf286c32f2494b96e81a8b3a0068551eed3ed75d31c1e653ece96d058b4ff96
7
- data.tar.gz: 3a83a2bbbac2b3be9cfd94d1b935abaf076acd6876d39ee3f5d8228d0ef9575fc3e8ec5944c18434282b1277f206541be226f45dbf24eca2d2bedd21cda8a5ae
6
+ metadata.gz: 0b80d4d432164e99dad3679fe1917b44157bf83f6e287952635d5132895ab894e6da1171ef0da6954666c059316723add45938cdc01e5ab2141ca127ca6958e2
7
+ data.tar.gz: bc0aa1579047a5758af253968c206b936e93f0c906a6f50a754777b1d878798d957e7c193aafdb05e0a178c06086f38c8a28ff8ebfbae6a4b20d5358fe3a8123
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9
4
+ version: 0.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file