Class: Device
- Inherits:
-
Object
- Object
- Device
- Defined in:
- lib/replicant/device.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #emulator? ⇒ Boolean
-
#initialize(id, name) ⇒ Device
constructor
A new instance of Device.
- #physical_device? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(id, name) ⇒ Device
Returns a new instance of Device.
4 5 6 7 |
# File 'lib/replicant/device.rb', line 4 def initialize(id, name) @id = id @name = name end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/replicant/device.rb', line 2 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/replicant/device.rb', line 2 def name @name end |
Instance Method Details
#emulator? ⇒ Boolean
9 10 11 |
# File 'lib/replicant/device.rb', line 9 def emulator? @id.start_with?('emulator-') end |
#physical_device? ⇒ Boolean
13 14 15 |
# File 'lib/replicant/device.rb', line 13 def physical_device? !emulator? end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/replicant/device.rb', line 17 def to_s "#{@id} [#{@name}]" end |