Apply suggestions from code review

Co-authored-by: Bo Anderson <mail@boanderson.me>
This commit is contained in:
Patrick Linnane 2024-08-18 21:19:46 -06:00
parent d992a4f923
commit a3600d07a2
No known key found for this signature in database

View File

@ -98,7 +98,7 @@ module Hardware
:dunno :dunno
end end
sig { returns(T.nilable(Integer)) } sig { returns(Integer) }
def cores def cores
return @cores if @cores return @cores if @cores
@ -178,12 +178,12 @@ module Hardware
false false
end end
sig { returns(T::Array[String]) } sig { returns(T::Array[Symbol]) }
def features def features
[] []
end end
sig { params(name: T::Array[String]).returns(T::Boolean) } sig { params(name: Symbol).returns(T::Boolean) }
def feature?(name) def feature?(name)
features.include?(name) features.include?(name)
end end
@ -203,7 +203,7 @@ module Hardware
end end
class << self class << self
sig { returns(T.nilable(T.any(Integer, String))) } sig { returns(String) }
def cores_as_words def cores_as_words
case Hardware::CPU.cores case Hardware::CPU.cores
when 1 then "single" when 1 then "single"
@ -213,7 +213,7 @@ module Hardware
when 8 then "octa" when 8 then "octa"
when 12 then "dodeca" when 12 then "dodeca"
else else
Hardware::CPU.cores Hardware::CPU.cores.to_s
end end
end end