Method: ComputeUnit::Device.find_all

Defined in:
lib/compute_unit/device.rb

.find_all(device_class_id = nil) ⇒ Array

Note:

there is not a filter applied

Returns - an array of pci bus device locations (every device on the pci bus).

Parameters:

  • - (String)

    the device class for filtering out devices

Returns:

  • (Array)
    • an array of pci bus device locations (every device on the pci bus)



197
198
199
200
201
202
# File 'lib/compute_unit/device.rb', line 197

def self.find_all(device_class_id = nil)
  Dir.glob(File.join(ComputeUnit::Device::SYSFS_DEVICES_PATH, '*')).map do |device_path|
    next create_from_path(device_path) unless device_class_id
    next create_from_path(device_path) if device_class(device_path) == device_class_id
  end.compact
end