rexle 0.7.4 → 0.7.5

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.
Files changed (2) hide show
  1. data/lib/rexle.rb +4 -3
  2. metadata +1 -1
@@ -6,6 +6,7 @@ require 'rexml/document'
6
6
  require 'rexleparser'
7
7
  require 'dynarex-parser'
8
8
  require 'polyrex-parser'
9
+ require 'pretty-xml'
9
10
  include REXML
10
11
 
11
12
  class Rexle
@@ -382,7 +383,7 @@ class Rexle
382
383
  def delete(xpath) @doc.element(xpath).delete end
383
384
  def element(xpath) @doc.element(xpath) end
384
385
  def elements(s=nil) @doc.elements(s) end
385
- def to_s(options={}) self.xml(options) end
386
+ def to_s() self.xml end
386
387
  def text(xpath) @doc.text(xpath) end
387
388
  def root() @doc end
388
389
 
@@ -391,11 +392,11 @@ class Rexle
391
392
  end
392
393
 
393
394
  def xml(options={})
394
- o = {:pretty => false}.merge(options)
395
+ o.merge!{pretty: false}
395
396
  body = scan_print(self.root.children).join
396
397
  a = self.root.attributes.to_a.map{|k,v| "%s='%s'" % [k,v]}
397
398
  out = "<%s%s>%s</%s>" % [self.root.name, a.empty? ? '' : ' ' + a.join(' '), body, self.root.name]
398
- o[:pretty] == false ? out : (write out)
399
+ o[:pretty] == false ? out : PrettyXML::write out
399
400
  end
400
401
 
401
402
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors: []
7
7