Class: Hwid::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hwid/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#systemidObject

Returns the value of attribute systemid.



8
9
10
# File 'lib/hwid/base.rb', line 8

def systemid
  @systemid
end

Instance Method Details

#get_linux_idObject



35
36
37
# File 'lib/hwid/base.rb', line 35

def get_linux_id
  res=`ifconfig |grep HWaddr`.split.last
end

#get_mac_idObject



31
32
33
34
# File 'lib/hwid/base.rb', line 31

def get_mac_id
  res=`system_profiler SPHardwareDataType -timeout 0 | grep Serial` 
  self.parse(res)
end

#get_rasp_idObject



27
28
29
30
# File 'lib/hwid/base.rb', line 27

def get_rasp_id
  res=`grep Serial  /proc/cpuinfo` 
  self.parse(res)
end

#parse(line) ⇒ Object

parse something like ‘Serial : xxxx’



13
14
15
16
17
18
# File 'lib/hwid/base.rb', line 13

def parse(line)
  res='unknown'
  raw=line.split(':')
  res=raw[1] if raw[1]!=nil
  res.strip
end

#platformObject



10
11
# File 'lib/hwid/base.rb', line 10

def platform
end