Class: Plist::PData

Inherits:
PTag
  • Object
show all
Defined in:
lib/plist/parser.rb

Instance Attribute Summary

Attributes inherited from PTag

#children, #options, #text

Instance Method Summary collapse

Methods inherited from PTag

inherited, #initialize, mappings

Constructor Details

This class inherits a constructor from Plist::PTag

Instance Method Details

#to_rubyObject



250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/plist/parser.rb', line 250

def to_ruby
  # unpack("m")[0] is equivalent to Base64.decode64
  data = text.gsub(/\s+/, '').unpack("m")[0] unless text.nil?
  begin
    return Marshal.load(data) if options[:marshal]
  rescue Exception
  end
  io = StringIO.new
  io.write data
  io.rewind
  io
end