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 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
- @save_unformated = false
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
- ftext = if @save_unformated
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 save_unformated=(val); @save_unformated = (val.is_a?(TrueClass) ? true : false); end
65
- def save_unformated?; @save_unformated; end
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "xml-smart"
3
- s.version = "0.3.7.2"
3
+ s.version = "0.3.8"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "An xml library that doesn't suck - since 2004."
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.2
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-08-29 00:00:00.000000000 Z
12
+ date: 2013-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri