lib/plist/parser.rb in plist-3.1.0 vs lib/plist/parser.rb in plist-3.2.0
- old
+ new
@@ -16,11 +16,11 @@
# Note that I don't use these two elements much:
#
# + Date elements are returned as DateTime objects.
# + Data elements are implemented as Tempfiles
#
-# Plist::parse_xml will blow up if it encounters a data element.
+# Plist::parse_xml will blow up if it encounters a Date element.
# If you encounter such an error, or if you have a Date element which
# can't be parsed into a Time object, please send your plist file to
# plist@hexane.org so that I can implement the proper support.
def Plist::parse_xml( filename_or_xml )
listener = Listener.new
@@ -61,11 +61,11 @@
class StreamParser
def initialize( plist_data_or_file, listener )
if plist_data_or_file.respond_to? :read
@xml = plist_data_or_file.read
- elsif File.exists? plist_data_or_file
+ elsif File.exist? plist_data_or_file
@xml = File.read( plist_data_or_file )
else
@xml = plist_data_or_file
end
@@ -208,11 +208,10 @@
end
require 'base64'
class PData < PTag
def to_ruby
- data = Base64.decode64(text.gsub(/\s+/, ''))
-
+ data = Base64.decode64(text.gsub(/\s+/, '')) unless text.nil?
begin
return Marshal.load(data)
rescue Exception => e
io = StringIO.new
io.write data