Class: BinaryPList::Parser::BPList00

Inherits:
ObjectReaders::Base show all
Defined in:
lib/binary_plist/parser/bplist00.rb

Constant Summary collapse

MAGIC =
"bplist00"
NotBPList00 =
Class.new(StandardError)

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ObjectReaders::Base

#read

Constructor Details

#initialize(io) ⇒ BPList00

Returns a new instance of BPList00.

Raises:



31
32
33
34
35
36
37
# File 'lib/binary_plist/parser/bplist00.rb', line 31

def initialize(io)
  io = StringIO.new(io) if io.is_a? String
  raise NotBPList00 unless io.read(MAGIC.length).eql? MAGIC

  @io = io
  super(self.class, io, nil, nil)
end

Class Method Details

.readersObject



17
18
19
20
21
22
23
24
25
# File 'lib/binary_plist/parser/bplist00.rb', line 17

def readers
  @readers ||= [
    ObjectReaders::ASCIIString,
    ObjectReaders::Array,
    ObjectReaders::Int,
    ObjectReaders::Null,
    ObjectReaders::UTF16String,
  ]
end

Instance Method Details

#parseObject



39
40
41
# File 'lib/binary_plist/parser/bplist00.rb', line 39

def parse
  object(trailer.top_object)
end