Class: SimCtl::DevicePath
- Inherits:
-
Object
- Object
- SimCtl::DevicePath
- Defined in:
- lib/simctl/device_path.rb
Instance Attribute Summary collapse
-
#device_plist ⇒ Object
readonly
Returns the value of attribute device_plist.
-
#home ⇒ Object
readonly
Returns the value of attribute home.
-
#preferences_plist ⇒ Object
readonly
Returns the value of attribute preferences_plist.
Instance Method Summary collapse
- #edit(path, &block) ⇒ Object
-
#initialize(udid) ⇒ DevicePath
constructor
A new instance of DevicePath.
Constructor Details
#initialize(udid) ⇒ DevicePath
Returns a new instance of DevicePath.
7 8 9 10 11 |
# File 'lib/simctl/device_path.rb', line 7 def initialize(udid) @home = File.join(ENV['HOME'], 'Library/Developer/CoreSimulator/Devices', udid) @device_plist = File.join(@home, 'device.plist') @preferences_plist = File.join(@home, 'data/Library/Preferences/com.apple.Preferences.plist') end |
Instance Attribute Details
#device_plist ⇒ Object (readonly)
Returns the value of attribute device_plist.
5 6 7 |
# File 'lib/simctl/device_path.rb', line 5 def device_plist @device_plist end |
#home ⇒ Object (readonly)
Returns the value of attribute home.
5 6 7 |
# File 'lib/simctl/device_path.rb', line 5 def home @home end |
#preferences_plist ⇒ Object (readonly)
Returns the value of attribute preferences_plist.
5 6 7 |
# File 'lib/simctl/device_path.rb', line 5 def preferences_plist @preferences_plist end |
Instance Method Details
#edit(path, &block) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/simctl/device_path.rb', line 13 def edit(path, &block) plist = File.exists?(path) ? CFPropertyList::List.new(file: path) : CFPropertyList::List.new content = CFPropertyList.native_types(plist.value) || {} plist.value = CFPropertyList.guess(yield content) plist.save(path, CFPropertyList::List::FORMAT_BINARY) end |