From 33c138751e34e52b88dd005c40f1639bb3f8c330 Mon Sep 17 00:00:00 2001 From: Markus Reiter <me@reitermark.us> Date: Sun, 9 Aug 2020 03:23:53 +0200 Subject: [PATCH] Refactor and document `Hardware`. --- Library/Homebrew/extend/os/linux/hardware/cpu.rb | 10 ++++++---- Library/Homebrew/hardware.rb | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb index e34507b55e..e51d656280 100644 --- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb @@ -11,10 +11,6 @@ module Hardware end end - def cpuinfo - @cpuinfo ||= File.read("/proc/cpuinfo") - end - def family return :arm if arm? return :ppc if ppc? @@ -94,6 +90,12 @@ module Hardware def sse4? flags.include? "sse4_1" end + + private + + def cpuinfo + @cpuinfo ||= File.read("/proc/cpuinfo") + end end end end diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 12a3d32a95..5d93e7df92 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -2,7 +2,9 @@ require "utils/popen" +# Helper module for querying hardware information. module Hardware + # Helper module for querying CPU information. class CPU INTEL_32BIT_ARCHS = [:i386].freeze INTEL_64BIT_ARCHS = [:x86_64].freeze -- GitLab