module SimCtl::Command::List
Public Instance Methods
device(filter)
click to toggle source
Find a device
@param filter [Hash] the filter @return [SimCtl::Device, nil] the device matching the given filter
# File lib/simctl/command/list.rb, line 8 def device(filter) list_devices.where(filter).first end
devicetype(filter)
click to toggle source
Find a device type
@param filter [Hash] the filter @return [SimCtl::DeviceType] the device type matching the given filter @raise [DeviceTypeNotFound] if the device type could not be found
# File lib/simctl/command/list.rb, line 17 def devicetype(filter) device_type = list_devicetypes.where(filter).first device_type || raise(DeviceTypeNotFound, "Could not find a device type matching #{filter.inspect}") end
list_devices()
click to toggle source
List
all devices
@return [SimCtl::List] a list of SimCtl::Device
objects
# File lib/simctl/command/list.rb, line 25 def list_devices Executor.execute(command_for('list', '-j', 'devices')) do |json| devices = json['devices'].map { |os, devs| devs.map { |device| Device.new(device.merge(os: os)) } } SimCtl::List.new(devices.flatten) end end
list_devicetypes()
click to toggle source
List
all device types
@return [SimCtl::List] a list of SimCtl::DeviceType
objects
# File lib/simctl/command/list.rb, line 35 def list_devicetypes Executor.execute(command_for('list', '-j', 'devicetypes')) do |json| SimCtl::List.new(json['devicetypes'].map { |devicetype| DeviceType.new(devicetype) }) end end
list_runtimes()
click to toggle source
List
all runtimes
@return [SimCtl::List] a list of SimCtl::Runtime
objects
# File lib/simctl/command/list.rb, line 44 def list_runtimes Executor.execute(command_for('list', '-j', 'runtimes')) do |json| SimCtl::List.new(json['runtimes'].map { |runtime| Runtime.new(runtime) }) end end
runtime(filter)
click to toggle source
Find a runtime
@param filter [Hash] the filter @return [SimCtl::Runtime] the runtime matching the given filter @raise [RuntimeNotFound] if the runtime could not be found
# File lib/simctl/command/list.rb, line 55 def runtime(filter) runtime = list_runtimes.where(filter).first runtime || raise(RuntimeNotFound, "Could not find a runtime matching #{filter.inspect}") end