Class: FDRData

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

Overview

Factory Device Restore

Instance Method Summary collapse

Methods inherited from AppleData::DataFile

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

Constructor Details

#initializeFDRData

Returns a new instance of FDRData.



6
7
8
9
10
11
12
# File 'lib/apple_data/fdr.rb', line 6

def initialize
  super('fdr.yaml')

  @data ||= {}

  @data['properties'] = []
end

Instance Method Details

#dataObject



25
26
27
28
29
# File 'lib/apple_data/fdr.rb', line 25

def data
  @data['properties'].sort_by! { |prop| prop['name'] }

  @data
end

#ensure_property(prop) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/apple_data/fdr.rb', line 14

def ensure_property(prop)
  prop_instance = @data['properties'].find { |p| p['name'] == prop }
  unless prop_instance
    prop_instance = {}
    prop_instance['name'] = prop
    prop_instance['description'] = nil
    @data['properties'] << prop_instance
  end
  prop_instance
end