Sha256: 30a79d40fec1f4fbf343dd7b9a1219a21c3e0d2fefbeeafde31bda21883154ea

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

require 'cfpropertylist'

require 'keyed_archive/unpacked_objects'
require 'keyed_archive/version'

class KeyedArchive
  attr_accessor :archiver, :objects, :top, :version

  # 
  # Take the same sort of arguments as CFPropertyList
  # :file => filename to load
  # :data => variable with the data to load directly
  def initialize(opts={})
    blob = opts[:data]
    filename = opts[:file]

    plist = CFPropertyList::List.new(:file => filename) unless filename.nil? or !File.exists?(filename)
    plist = CFPropertyList::List.new(:data => blob) unless blob.nil? or blob.length < 1

    if !plist.nil?
      data = CFPropertyList.native_types(plist.value)

      @archiver = data['$archiver']
      @objects = data['$objects']
      @top = data['$top']
      @version = data['$version']
    else
      raise "Plist not created"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
keyed_archive-1.0.0 lib/keyed_archive.rb