rexle 0.9.65 → 0.9.66

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rexle.rb +8 -1
  2. metadata +1 -1
data/lib/rexle.rb CHANGED
@@ -767,7 +767,12 @@ class Rexle
767
767
  def elements(s=nil) @doc.elements(s) end
768
768
  def name() @doc.root.name end
769
769
  def to_a() @a end
770
- def to_s(options={}) self.xml options end
770
+
771
+ def to_s(options={})
772
+ return '<UNDEFINED/>' unless @doc
773
+ self.xml options
774
+ end
775
+
771
776
  def text(xpath) @doc.text(xpath) end
772
777
  def root() @doc.elements.first end
773
778
 
@@ -776,6 +781,8 @@ class Rexle
776
781
  end
777
782
 
778
783
  def xml(options={})
784
+
785
+ return '' unless @doc
779
786
  o = {pretty: false, declaration: true}.merge(options)
780
787
  msg = o[:pretty] == false ? :doc_print : :doc_pretty_print
781
788
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.65
5
+ version: 0.9.66
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson