lib/simctl/device.rb in simctl-1.6.2 vs lib/simctl/device.rb in simctl-1.6.3

- old
+ new

@@ -69,11 +69,11 @@ end # Launches the Simulator # # @return [void] - def launch(scale=1.0, opts={}) + def launch(scale = 1.0, opts = {}) SimCtl.launch_device(self, scale, opts) end # Returns the launchctl object # @@ -86,20 +86,20 @@ # # @param opts [Hash] options hash - `{ wait_for_debugger: true/false }` # @param identifier [String] the app identifier # @param args [Array] optional launch arguments # @return [void] - def launch_app(identifier, args=[], opts={}) + def launch_app(identifier, args = [], opts = {}) SimCtl.launch_app(self, identifier, args, opts) end # Terminates an app on the given device # # @param identifier [String] the app identifier # @param args [Array] optional terminate arguments # @return [void] - def terminate_app(identifier, args=[]) + def terminate_app(identifier, args = []) SimCtl.terminate_app(self, identifier, args) end # Opens the url on the device # @@ -119,11 +119,11 @@ # Unfortunately the 'booted' state does not mean the Simulator is ready for # installing or launching applications. # # @return [Bool] def ready? - running_services = launchctl.list.reject {|service| service.pid.to_i == 0 }.map {|service| service.name} + running_services = launchctl.list.reject { |service| service.pid.to_i == 0 }.map(&:name) (required_services_for_ready - running_services).empty? end # Reloads the device information # @@ -162,11 +162,11 @@ # @param file Path where the screenshot should be saved to # @param opts Optional hash that supports two keys: # * type: Can be png, tiff, bmp, gif, jpeg (default is png) # * display: Can be main or tv for iOS, tv for tvOS and main for watchOS # @return [void] - def screenshot(file, opts={}) + def screenshot(file, opts = {}) SimCtl.screenshot(self, file, opts) end # Returns the settings object # @@ -185,11 +185,11 @@ # Spawn a process on a device # # @param path [String] path to executable # @param args [Array] arguments for the executable # @return [void] - def spawn(path, args=[], opts={}) + def spawn(path, args = [], opts = {}) SimCtl.spawn(self, path, args, opts) end # Returns the state of the device # @@ -199,22 +199,22 @@ end # Reloads the device until the given block returns true # # @return [void] - def wait(timeout=SimCtl.default_timeout) - Timeout::timeout(timeout) do + def wait(timeout = SimCtl.default_timeout) + Timeout.timeout(timeout) do loop do break if yield SimCtl.device(udid: udid) end end reload end def ==(other) return false if other.nil? - return false unless other.kind_of? Device + return false unless other.is_a? Device other.udid == udid end def method_missing(method_name, *args, &block) if method_name[-1] == '!' @@ -237,37 +237,37 @@ case runtime.type when :tvos, :watchos if Xcode::Version.gte? '8.0' [ 'com.apple.mobileassetd', - 'com.apple.nsurlsessiond', + 'com.apple.nsurlsessiond' ] else [ 'com.apple.mobileassetd', - 'com.apple.networkd', + 'com.apple.networkd' ] end when :ios if Xcode::Version.gte? '9.0' [ 'com.apple.backboardd', 'com.apple.mobile.installd', 'com.apple.CoreSimulator.bridge', - 'com.apple.SpringBoard', + 'com.apple.SpringBoard' ] elsif Xcode::Version.gte? '8.0' [ 'com.apple.SimulatorBridge', 'com.apple.SpringBoard', 'com.apple.backboardd', - 'com.apple.mobile.installd', + 'com.apple.mobile.installd' ] else [ 'com.apple.SimulatorBridge', 'com.apple.SpringBoard', - 'com.apple.mobile.installd', + 'com.apple.mobile.installd' ] end else [] end