Merge pull request #8451 from reitermarkus/document-hardware

Refactor and document `Hardware`.
This commit is contained in:
Markus Reiter 2020-08-23 04:40:20 +02:00 committed by GitHub
commit 39cc754a8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -11,10 +11,6 @@ module Hardware
end end
end end
def cpuinfo
@cpuinfo ||= File.read("/proc/cpuinfo")
end
def family def family
return :arm if arm? return :arm if arm?
return :ppc if ppc? return :ppc if ppc?
@ -94,6 +90,12 @@ module Hardware
def sse4? def sse4?
flags.include? "sse4_1" flags.include? "sse4_1"
end end
private
def cpuinfo
@cpuinfo ||= File.read("/proc/cpuinfo")
end
end end
end end
end end

View File

@ -2,7 +2,9 @@
require "utils/popen" require "utils/popen"
# Helper module for querying hardware information.
module Hardware module Hardware
# Helper module for querying CPU information.
class CPU class CPU
INTEL_32BIT_ARCHS = [:i386].freeze INTEL_32BIT_ARCHS = [:i386].freeze
INTEL_64BIT_ARCHS = [:x86_64].freeze INTEL_64BIT_ARCHS = [:x86_64].freeze