Class: AppleData::GIDKeyBag

Inherits:
DataFile show all
Defined in:
lib/apple_data/keybag.rb

Overview

Represents a GID grouping of encrypted and decrypted keybags

Defined Under Namespace

Classes: BoardKeyBag

Instance Attribute Summary

Attributes inherited from DataFile

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DataFile

#auto_sort?, #collection, from_path, #load_file, #save, #save!, #sort!

Constructor Details

#initialize(chip_id) ⇒ GIDKeyBag

Returns a new instance of GIDKeyBag.



28
29
30
# File 'lib/apple_data/keybag.rb', line 28

def initialize(chip_id)
  super('keybags', chip_id.to_s)
end

Class Method Details

.[](chip_id) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/apple_data/keybag.rb', line 18

def [](chip_id)
  chip_id = chip_id.to_i
  return @keybags[chip_id] if @keybags.key? chip_id

  instance = allocate
  instance.send(:initialize, chip_id)
  @keybags[chip_id] = instance
end

.new(chip_id) ⇒ Object



10
11
12
# File 'lib/apple_data/keybag.rb', line 10

def new(chip_id)
  self.[](chip_id)
end

.save_allObject



14
15
16
# File 'lib/apple_data/keybag.rb', line 14

def save_all
  @keybags.each_value(&:save)
end

Instance Method Details

#get_board(board_id) ⇒ Object



32
33
34
35
# File 'lib/apple_data/keybag.rb', line 32

def get_board(board_id)
  board_id = board_id.to_i
  BoardKeyBag.new self, board_id, collection(:keybag_boards).ensure_key(board_id, description: false)
end