xml-smart 0.3.7.2 → 0.3.8
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/Rakefile +10 -0
- data/lib/xml/smart_dom.rb +9 -6
- data/xml-smart.gemspec +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -12,4 +12,14 @@ spec = eval(File.read('xml-smart.gemspec'))
|
|
12
12
|
Gem::PackageTask.new(spec) do |pkg|
|
13
13
|
pkg.need_zip = true
|
14
14
|
pkg.need_tar = true
|
15
|
+
`rm pkg/* -rf`
|
16
|
+
`ln -sf #{pkg.name}.gem pkg/xml-smart.gem`
|
15
17
|
end
|
18
|
+
|
19
|
+
task :push => :gem do |r|
|
20
|
+
`gem push pkg/xml-smart.gem`
|
21
|
+
end
|
22
|
+
|
23
|
+
task :install => :gem do |r|
|
24
|
+
`sudo gem install pkg/xml-smart.gem`
|
25
|
+
end
|
data/lib/xml/smart_dom.rb
CHANGED
@@ -3,7 +3,7 @@ module XML
|
|
3
3
|
class Dom
|
4
4
|
def initialize(dom)
|
5
5
|
@dom = dom
|
6
|
-
@
|
6
|
+
@unformated = false
|
7
7
|
end
|
8
8
|
|
9
9
|
def ===(cls); self.is_a? cls; end
|
@@ -52,17 +52,20 @@ module XML
|
|
52
52
|
rescue
|
53
53
|
raise Error, "could not open #{name}"
|
54
54
|
end
|
55
|
-
|
55
|
+
io.write serialize
|
56
|
+
io.close unless name == io
|
57
|
+
end
|
58
|
+
|
59
|
+
def serialize
|
60
|
+
if @unformated
|
56
61
|
@dom.root.serialize(:encoding => 'UTF-8', :save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION | Nokogiri::XML::Node::SaveOptions::AS_XML)
|
57
62
|
else
|
58
63
|
@dom.root.serialize(:encoding => 'UTF-8', :save_with => Nokogiri::XML::Node::SaveOptions::FORMAT | Nokogiri::XML::Node::SaveOptions::AS_XML)
|
59
64
|
end
|
60
|
-
io.write ftext
|
61
|
-
io.close unless name == io
|
62
65
|
end
|
63
66
|
|
64
|
-
def
|
65
|
-
def
|
67
|
+
def unformated=(val); @unformated = (val.is_a?(TrueClass) ? true : false); end
|
68
|
+
def unformated?; @unformated; end
|
66
69
|
|
67
70
|
def xinclude!(basedir=nil)
|
68
71
|
Element.new(@dom.root).xinclude!(basedir)
|
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.
|
4
|
+
version: 0.3.8
|
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-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|