lib/xmlsimple.rb in xml-simple-1.1.1 vs lib/xmlsimple.rb in xml-simple-1.1.2
- old
+ new
@@ -9,11 +9,11 @@
# Easy API to maintain XML (especially configuration files).
class XmlSimple
include REXML
- @@VERSION = '1.1.0'
+ @@VERSION = '1.1.2'
# A simple cache for XML documents that were already transformed
# by xml_in.
class Cache
# Creates and initializes a new Cache object.
@@ -183,13 +183,13 @@
}
end
@doc = load_xml_file(filename)
end
- elsif string.kind_of?(IO) || string.kind_of?(StringIO) || string.kind_of?(Zlib::GzipReader)
+ elsif string.respond_to?(:read)
@doc = parse(string.read)
else
- raise ArgumentError, "Could not parse object of type: <#{string.type}>."
+ raise ArgumentError, "Could not parse object of type: <#{string.class}>."
end
result = collapse(@doc.root)
result = @options['keeproot'] ? merge({}, @doc.root.name, result) : result
put_into_cache(result, filename)