Method: Informo::Memory#slots

Defined in:
lib/informo/memory.rb

#slotsObject

returns details for memory installed in each memory slot

  • size

  • location on board

  • speed

  • form factor



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/informo/memory.rb', line 56

def slots
  count = -1
  modules = Array.new
  
  `dmidecode -t 17`.each_line do |line|
    if line =~ /\cI(Array Handle|Size|Locator|Speed|Form Factor):\s*(.*)$/
      key, value = $1, $2
      if key =~ /Array Handle/
        count += 1
        modules[count] = Hash.new
      else
        key = "type" if key =~ /Form Factor/
        modules[count][key.downcase] = value
      end
    end
  end
  
  return modules
end