Spaces:
Build error
Build error
File size: 454 Bytes
def1299 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
module SystemInfo
def self.sys_info
@@sys_info ||= self.cpu_info.merge(self.mem_info)
end
def self.cpu_info #sorryforthisline
@@cpu_info ||= Hash[`lscpu`.split("\n").collect{|l| l = l.split(":"); [l[0].strip, l[1].strip]}]
end
def self.mem_info #sorryagain #itjustworks
@@mem_info ||= Hash[`free -h`.split("\n")[1..-1].collect{|l| l = l.split(":"); [l[0].strip, l[1].split(" ")[0].strip]}].without("-/+ buffers/cache")
end
end
|