Class: KeyedArchive
- Inherits:
-
Object
- Object
- KeyedArchive
- Defined in:
- lib/imsg-grep/apple/keyed_archive.rb
Defined Under Namespace
Classes: BinaryString
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ KeyedArchive
constructor
A new instance of KeyedArchive.
- #json ⇒ Object
- #unarchive ⇒ Object
Constructor Details
#initialize(data) ⇒ KeyedArchive
Returns a new instance of KeyedArchive.
21 22 23 24 25 26 |
# File 'lib/imsg-grep/apple/keyed_archive.rb', line 21 def initialize(data) return unless data return if data[0, 4] == "\x08\x08\x11\x00" # DigitalTouchBalloonProvider row; another format, ignore raise "no bplist: #{data}" unless data.start_with?("bplist") @data = BPList.parse data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/imsg-grep/apple/keyed_archive.rb', line 11 def data @data end |
Class Method Details
.json ⇒ Object
19 |
# File 'lib/imsg-grep/apple/keyed_archive.rb', line 19 def self.json(...) = new(...).json |
.unarchive ⇒ Object
18 |
# File 'lib/imsg-grep/apple/keyed_archive.rb', line 18 def self.unarchive(...) = new(...).unarchive |
Instance Method Details
#json ⇒ Object
36 |
# File 'lib/imsg-grep/apple/keyed_archive.rb', line 36 def json = unarchive&.to_json |
#unarchive ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/imsg-grep/apple/keyed_archive.rb', line 28 def unarchive return unless @data # initialize failed top = @data["$top"] or raise "no top" root = top["root"] or raise "no root" objs = @data["$objects"] or raise "no objects" decode_objects dereference_uids(root, objs) end |