lib/plist4r/backend/libxml4r.rb in plist4r-0.1.0 vs lib/plist4r/backend/libxml4r.rb in plist4r-0.1.1
- old
+ new
@@ -1,9 +1,9 @@
-require 'plist4r/backend'
+require 'plist4r/backend_base'
-module Plist4r::Backend::Libxml4rXmlReader
+module Plist4r::Backend::Libxml4r
class << self
def tree_hash n
hash = ::ActiveSupport::OrderedHash.new
n_xml_keys = n.nodes["key"]
n_xml_keys.each do |n|
@@ -47,10 +47,11 @@
end
return array
end
def parse_plist_xml string
+ require 'rubygems'
require 'libxml4r'
::LibXML::XML.default_keep_blanks = false
doc = string.to_xmldoc
doc.strip!
root = doc.node["/plist/dict"]
@@ -58,13 +59,12 @@
end
def from_string plist, string
plist_format = Plist4r.string_detect_format string
raise "#{self} - cant convert string of format #{plist_format}" unless plist_format == :xml
-
hash = parse_plist_xml string
plist.import_hash hash
- plist.file_format = file_format
+ plist.file_format plist_format
return plist
end
def open plist
filename = plist.filename_path