Class: BinaryPList::Parser::ObjectReaders::Int
- Inherits:
-
Base
- Object
- Base
- BinaryPList::Parser::ObjectReaders::Int
show all
- Defined in:
- lib/binary_plist/parser/object_readers/int.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Class Method Details
.reads?(marker) ⇒ Boolean
9
10
11
|
# File 'lib/binary_plist/parser/object_readers/int.rb', line 9
def self.reads?(marker)
(0b0001_0000..0b0001_1111).include?(marker)
end
|
Instance Method Details
#read(marker) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/binary_plist/parser/object_readers/int.rb', line 13
def read(marker)
raise UnsupportedMarkerError, marker unless self.class.reads?(marker)
marker_length = marker & 0xF
bytes_count = (1 << marker_length)
read_int(bytes_count)
end
|