Class: SimCtl::Device
Instance Attribute Summary collapse
-
#availability ⇒ Object
readonly
Returns the value of attribute availability.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
-
#state ⇒ sym
readonly
Returns the state of the device.
-
#udid ⇒ Object
readonly
Returns the value of attribute udid.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#boot! ⇒ void
Boots the device.
-
#delete! ⇒ void
Deletes the device.
-
#devicetype ⇒ SimCtl::DeviceType
Returns the device type.
-
#disable_keyboard_helpers! ⇒ void
Disables the keyboard helpers.
-
#erase! ⇒ void
Erases the device.
-
#kill! ⇒ void
Kills the device.
-
#launch!(scale = 1.0, opts = {}) ⇒ void
Launches the Simulator.
- #path ⇒ Object
-
#rename!(name) ⇒ void
Renames the device.
-
#reset! ⇒ void
Resets the device.
-
#runtime ⇒ SimCtl::Runtime
Resets the runtime.
-
#shutdown! ⇒ void
Shuts down the runtime.
-
#wait!(timeout = 15) ⇒ void
Reloads the device until the given block returns true.
Methods inherited from Object
Constructor Details
This class inherits a constructor from SimCtl::Object
Instance Attribute Details
#availability ⇒ Object (readonly)
Returns the value of attribute availability.
9 10 11 |
# File 'lib/simctl/device.rb', line 9 def availability @availability end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/simctl/device.rb', line 9 def name @name end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
9 10 11 |
# File 'lib/simctl/device.rb', line 9 def os @os end |
#state ⇒ sym (readonly)
Returns the state of the device
109 110 111 |
# File 'lib/simctl/device.rb', line 109 def state @state end |
#udid ⇒ Object (readonly)
Returns the value of attribute udid.
9 10 11 |
# File 'lib/simctl/device.rb', line 9 def udid @udid end |
Instance Method Details
#==(other) ⇒ Object
124 125 126 127 128 |
# File 'lib/simctl/device.rb', line 124 def ==(other) return false if other.nil? return false unless other.kind_of? Device other.udid == udid end |
#boot! ⇒ void
This method returns an undefined value.
Boots the device
14 15 16 |
# File 'lib/simctl/device.rb', line 14 def boot! SimCtl.boot_device(self) end |
#delete! ⇒ void
This method returns an undefined value.
Deletes the device
21 22 23 |
# File 'lib/simctl/device.rb', line 21 def delete! SimCtl.delete_device(self) end |
#devicetype ⇒ SimCtl::DeviceType
Returns the device type
28 29 30 |
# File 'lib/simctl/device.rb', line 28 def devicetype @devicetype ||= SimCtl.devicetype(identifier: plist.deviceType) end |
#disable_keyboard_helpers! ⇒ void
This method returns an undefined value.
Disables the keyboard helpers
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/simctl/device.rb', line 35 def disable_keyboard_helpers! path.edit path.preferences_plist do |plist| %w( KeyboardPeriodShortcut KeyboardAutocapitalization KeyboardCheckSpelling KeyboardAssistant KeyboardAutocorrection KeyboardPrediction KeyboardShowPredictionBar KeyboardCapsLock ).each do |key| plist[key] = false end plist end end |
#erase! ⇒ void
This method returns an undefined value.
Erases the device
56 57 58 |
# File 'lib/simctl/device.rb', line 56 def erase! SimCtl.erase_device(self) end |
#kill! ⇒ void
This method returns an undefined value.
Kills the device
63 64 65 |
# File 'lib/simctl/device.rb', line 63 def kill! SimCtl.kill_device(self) end |
#launch!(scale = 1.0, opts = {}) ⇒ void
This method returns an undefined value.
Launches the Simulator
70 71 72 |
# File 'lib/simctl/device.rb', line 70 def launch!(scale=1.0, opts={}) SimCtl.launch_device(self, scale, opts) end |
#path ⇒ Object
74 75 76 |
# File 'lib/simctl/device.rb', line 74 def path @path ||= DevicePath.new(udid) end |
#rename!(name) ⇒ void
This method returns an undefined value.
Renames the device
81 82 83 |
# File 'lib/simctl/device.rb', line 81 def rename!(name) SimCtl.rename_device(self, name) end |
#reset! ⇒ void
This method returns an undefined value.
Resets the device
88 89 90 |
# File 'lib/simctl/device.rb', line 88 def reset! SimCtl.reset_device name, devicetype, runtime end |
#runtime ⇒ SimCtl::Runtime
Resets the runtime
95 96 97 |
# File 'lib/simctl/device.rb', line 95 def runtime @runtime ||= SimCtl.runtime(identifier: plist.runtime) end |
#shutdown! ⇒ void
This method returns an undefined value.
Shuts down the runtime
102 103 104 |
# File 'lib/simctl/device.rb', line 102 def shutdown! SimCtl.shutdown_device(self) end |
#wait!(timeout = 15) ⇒ void
This method returns an undefined value.
Reloads the device until the given block returns true
116 117 118 119 120 121 122 |
# File 'lib/simctl/device.rb', line 116 def wait!(timeout=15) Timeout::timeout(timeout) do loop do break if yield SimCtl.device(udid: udid) end end end |