Class: Device

Inherits:
Object
  • Object
show all
Defined in:
lib/replicant/device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/replicant/device.rb', line 2

def id
  @id
end

#nameObject (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

Returns:

  • (Boolean)


9
10
11
# File 'lib/replicant/device.rb', line 9

def emulator?
  @id.start_with?('emulator-')
end

#physical_device?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/replicant/device.rb', line 13

def physical_device?
  !emulator?
end

#to_sObject



17
18
19
# File 'lib/replicant/device.rb', line 17

def to_s
  "#{@id} [#{@name}]"
end