Class: XCSim::OSDevices
- Inherits:
-
Object
- Object
- XCSim::OSDevices
- Includes:
- Comparable
- Defined in:
- lib/xcsim/rbOSDevices.rb
Overview
A collection of DeviceID objects related to a given iOS Simulator OS version
Instance Attribute Summary collapse
-
#devices ⇒ Object
readonly
A hash of
deviceName => DeviceID
. -
#id ⇒ Object
readonly
An OSID of the iOS Simulator OS version related to the OSDevices collection.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Compares by
id
. -
#initialize(id, devices) ⇒ OSDevices
constructor
- Initializes an OSDevices instance with a given OSID and a collection of devices
id
- OSID to associate with the OSDevices object
devices
-
A collection of DeviceID objects.
- OSID to associate with the OSDevices object
- Initializes an OSDevices instance with a given OSID and a collection of devices
-
#inspect ⇒ Object
Returns a string in
'iOS 9.0 (5 devices)'
format. -
#to_s ⇒ Object
Same as #inspect.
Constructor Details
#initialize(id, devices) ⇒ OSDevices
Initializes an OSDevices instance with a given OSID and a collection of devices
id
-
OSID to associate with the OSDevices object
devices
-
A collection of DeviceID objects. Should support #each method for enumeration.
17 18 19 20 21 22 23 24 |
# File 'lib/xcsim/rbOSDevices.rb', line 17 def initialize(id, devices) @id = id devicesHash = {} devices.each{ |d| devicesHash[d.name] = d } @devices = devicesHash end |
Instance Attribute Details
#devices ⇒ Object (readonly)
A hash of deviceName => DeviceID
12 13 14 |
# File 'lib/xcsim/rbOSDevices.rb', line 12 def devices @devices end |
#id ⇒ Object (readonly)
An OSID of the iOS Simulator OS version related to the OSDevices collection
9 10 11 |
# File 'lib/xcsim/rbOSDevices.rb', line 9 def id @id end |
Instance Method Details
#<=>(other) ⇒ Object
Compares by id
39 40 41 |
# File 'lib/xcsim/rbOSDevices.rb', line 39 def <=>(other) @id <=> other.id end |
#inspect ⇒ Object
Returns a string in 'iOS 9.0 (5 devices)'
format
27 28 29 |
# File 'lib/xcsim/rbOSDevices.rb', line 27 def inspect "#{@id.inspect} (#{@devices.count} devices)" end |
#to_s ⇒ Object
Same as #inspect
32 33 34 |
# File 'lib/xcsim/rbOSDevices.rb', line 32 def to_s inspect end |