rasantiago-tiny_xpath_helper 0.1.7 → 0.1.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/lib/tiny_xpath_helper.rb +5 -5
- data/tiny_xpath_helper.gemspec +1 -1
- metadata +1 -1
data/lib/tiny_xpath_helper.rb
CHANGED
@@ -17,7 +17,7 @@ class TinyXPathHelper
|
|
17
17
|
r = default_options.dup
|
18
18
|
|
19
19
|
options.reverse.each do |option|
|
20
|
-
if not Hash
|
20
|
+
if not option.is_a?( Hash )
|
21
21
|
option = {:format => option}
|
22
22
|
end
|
23
23
|
r.update(option)
|
@@ -49,20 +49,20 @@ class TinyXPathHelper
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def self.xml_node_for_xmlish( xml, options = {} )
|
52
|
-
if io_stream_classes.any?{|k| k
|
52
|
+
if io_stream_classes.any?{|k| xml.is_a?(k) }
|
53
53
|
xml = xml.read
|
54
54
|
end
|
55
|
-
if String
|
55
|
+
if xml.is_a?(String)
|
56
56
|
xml = REXML::Document.new(xml)
|
57
57
|
end
|
58
|
-
if REXML::Document
|
58
|
+
if xml.is_a?(REXML::Document)
|
59
59
|
if options[:allow_empty_document] and ! xml.root
|
60
60
|
xml = xml
|
61
61
|
else
|
62
62
|
xml = xml.root
|
63
63
|
end
|
64
64
|
end
|
65
|
-
if not REXML::Element
|
65
|
+
if not xml.is_a?(REXML::Element)
|
66
66
|
raise TypeError.new("Expected REXML::Element, got #{xml.class}")
|
67
67
|
end
|
68
68
|
return xml
|
data/tiny_xpath_helper.gemspec
CHANGED