Class: BinaryPList::Parser::ObjectReaders::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/binary_plist/parser/object_readers/base.rb

Overview

In order for a subclass to be used by Base#read_object, it must do three things: 1) Be included in the main_class.readers 2) Implement .reads?(marker) - which returns true when it can read the

given marker

3) Implement #read(marker) - which reads the given marker.

Direct Known Subclasses

BPList00, ASCIIString, Array, Int, Null, UTF16String

Instance Method Summary collapse

Constructor Details

#initialize(main_class, io, offset_table, trailer) ⇒ Base

Returns a new instance of Base.



13
14
15
16
17
18
# File 'lib/binary_plist/parser/object_readers/base.rb', line 13

def initialize(main_class, io, offset_table, trailer)
  @main_class = main_class
  @io = io
  @offset_table = offset_table
  @trailer = trailer
end

Instance Method Details

#read(marker) ⇒ Object

called in subclasses by #read_object. at the beginning of #read,, the next byte read by any read calls to #io will be the byte immediately following the marker byte.

Parameters:

  • marker (Integer)

    the marker byte

Returns:

  • some object

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/binary_plist/parser/object_readers/base.rb', line 25

def read(marker)
  raise NotImplementedError
end