xml-smart 0.3.7 → 0.3.7.1
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.
- data/lib/xml/smart.rb +7 -1
- data/lib/xml/smart_domelement.rb +1 -1
- data/test/EXAMPLE.tmp.xml +0 -1
- data/test/EXAMPLE.xml +1 -1
- data/test/concurrent.xml +1 -7
- data/test/tc_concurrent.rb +2 -2
- data/xml-smart.gemspec +1 -1
- metadata +2 -2
data/lib/xml/smart.rb
CHANGED
@@ -141,6 +141,7 @@ module XML
|
|
141
141
|
io.flock(File::LOCK_EX)
|
142
142
|
end
|
143
143
|
dom = Dom.new Nokogiri::XML::parse(io){|config| config.noblanks.noent.nsclean.strict }
|
144
|
+
io.rewind
|
144
145
|
end
|
145
146
|
block.call(dom)
|
146
147
|
dom.save_as(io)
|
@@ -148,7 +149,12 @@ module XML
|
|
148
149
|
puts e.message
|
149
150
|
raise Error, "could not open #{name}"
|
150
151
|
ensure
|
151
|
-
|
152
|
+
if io
|
153
|
+
io.flush
|
154
|
+
io.truncate(io.pos)
|
155
|
+
io.flock(File::LOCK_UN)
|
156
|
+
io.close if name.is_a?(String)
|
157
|
+
end
|
152
158
|
end
|
153
159
|
nil
|
154
160
|
end
|
data/lib/xml/smart_domelement.rb
CHANGED
data/test/EXAMPLE.tmp.xml
CHANGED
data/test/EXAMPLE.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<test xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xml:lang="de">
|
2
2
|
<names>
|
3
|
-
<name team="0" a="3">2013-
|
3
|
+
<name team="0" a="3">2013-08-30 00:29:20 +0200</name>
|
4
4
|
<name team="1">Jürgen</name>
|
5
5
|
<name team="1">Michel</name>
|
6
6
|
<name team="1">Raphi</name>
|
data/test/concurrent.xml
CHANGED
@@ -1,7 +1 @@
|
|
1
|
-
<solutions>
|
2
|
-
<solution matnr="9906264" name="mangler" secid="1" when="2013-07-31T19:41:48+02:00" assessment="16">
|
3
|
-
<question block="1" question="2"/>
|
4
|
-
<question block="2" question="4"/>
|
5
|
-
<question block="3" question="6"/>
|
6
|
-
</solution>
|
7
|
-
</solutions>
|
1
|
+
<solutions><solution matnr="9906264" name="mangler" secid="1" assessment="16"><question block="1" question="2"/><question block="2" question="4"/><question block="3" question="6"/></solution></solutions>
|
data/test/tc_concurrent.rb
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
|
|
4
4
|
class TestConcurrent < MiniTest::Unit::TestCase
|
5
5
|
def test_unformated
|
6
6
|
# Watch the power
|
7
|
-
nums =
|
7
|
+
nums = 1000
|
8
8
|
|
9
9
|
id = 16
|
10
10
|
e_matnr = "9906264"
|
@@ -39,7 +39,7 @@ class TestConcurrent < MiniTest::Unit::TestCase
|
|
39
39
|
|
40
40
|
def test_formated
|
41
41
|
# Watch the power
|
42
|
-
nums =
|
42
|
+
nums = 1000
|
43
43
|
|
44
44
|
id = 16
|
45
45
|
e_matnr = "9906264"
|
data/xml-smart.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml-smart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.7
|
4
|
+
version: 0.3.7.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|