Class: Hwid::Base
- Inherits:
-
Object
- Object
- Hwid::Base
- Defined in:
- lib/hwid/base.rb
Instance Attribute Summary collapse
-
#systemid ⇒ Object
Returns the value of attribute systemid.
Instance Method Summary collapse
- #get_linux_id ⇒ Object
- #get_mac_id ⇒ Object
- #get_rasp_id ⇒ Object
-
#parse(line) ⇒ Object
parse something like ‘Serial : xxxx’.
- #platform ⇒ Object
Instance Attribute Details
#systemid ⇒ Object
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_id ⇒ Object
35 36 37 |
# File 'lib/hwid/base.rb', line 35 def get_linux_id res=`ifconfig |grep HWaddr`.split.last end |
#get_mac_id ⇒ Object
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_id ⇒ Object
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 |
#platform ⇒ Object
10 11 |
# File 'lib/hwid/base.rb', line 10 def platform end |