Class: SimCtl::DeviceLaunchctl

Inherits:
Object
  • Object
show all
Defined in:
lib/simctl/device_launchctl.rb

Instance Method Summary collapse

Constructor Details

#initialize(device) ⇒ DeviceLaunchctl

Returns a new instance of DeviceLaunchctl.



5
6
7
# File 'lib/simctl/device_launchctl.rb', line 5

def initialize(device)
  @device = device
end

Instance Method Details

#listObject



9
10
11
12
13
14
15
16
17
# File 'lib/simctl/device_launchctl.rb', line 9

def list
  fields = %i[pid status name]
  device
    .spawn(device.path.launchctl, ['list'])
    .split("\n")
    .drop(1)
    .map { |item| Hash[fields.zip(item.split("\t"))] }
    .map { |item| OpenStruct.new(item) }
end