Module: Liri::Common::Hardware

Defined in:
lib/common/hardware.rb

Overview

Módulo Hardware

Este módulo se encarga de obtener información del hardware

Class Method Summary collapse

Class Method Details

.cpuObject



11
12
13
14
15
16
17
18
19
# File 'lib/common/hardware.rb', line 11

def cpu
  cpu = %x|inxi -C|
  cpu = cpu.to_s.match(/model(.+)bits/)
  cpu = cpu[1].gsub("12", "")
  cpu = cpu.gsub(":", "")
  cpu.strip
rescue Errno::ENOENT
  raise InxiCommandNotFoundError.new
end

.memoryObject



21
22
23
24
25
# File 'lib/common/hardware.rb', line 21

def memory
  memory = %x|grep MemTotal /proc/meminfo|
  memory = memory.to_s.match(/(\d+)/)
  (memory[1].to_i * 0.000001).to_i
end