Class: AdbDevice::Device

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

Instance Method Summary collapse

Constructor Details

#initialize(sn) ⇒ Device

Returns a new instance of Device.



4
5
6
# File 'lib/adb_device/device.rb', line 4

def initialize(sn)
  @sn = sn
end

Instance Method Details

#brandObject



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

def brand
  output = `adb -s #{@sn} shell getprop ro.product.brand`
  brand = output.tr("\n", "")
end

#modelObject



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

def model
  output = `adb -s #{@sn} shell getprop ro.product.model`
  model = output.tr("\n", "")
end

#osObject



18
19
20
21
# File 'lib/adb_device/device.rb', line 18

def os
  output = `adb -s #{@sn} shell getprop ro.build.version.release`
  os = output.match(Regexp.new(/([0-9]{1,2}|[0-9]{1,2}.[0-9]{1,2}|[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2})\n/))[1]
end