Class: AdbSdkLib::DeviceList
- Inherits:
-
Hash
- Object
- Hash
- AdbSdkLib::DeviceList
- Defined in:
- lib/adb-sdklib.rb
Overview
List of devices. It can be used as Enumerable like Set, and as Hash which key
is the serial number of the device.
Instance Method Summary collapse
-
#each {|device| ... } ⇒ Enumerator, self
Calls block once for each device in self, passing that device as a parameter.
-
#initialize(devices = []) ⇒ DeviceList
constructor
A new instance of DeviceList.
Constructor Details
#initialize(devices = []) ⇒ DeviceList
Returns a new instance of DeviceList.
13 14 15 |
# File 'lib/adb-sdklib.rb', line 13 def initialize(devices = []) devices.each { |d| self[d.serial_number] = d } end |
Instance Method Details
#each {|device| ... } ⇒ Enumerator, self
Calls block once for each device in self, passing that device as a parameter. If no block is given, an enumerator is returned instead.
22 23 24 25 26 |
# File 'lib/adb-sdklib.rb', line 22 def each return self.values.each unless block_given? self.values.each {|device| yield device } return self end |