Class: OS::Mac::Version Private
- Defined in:
- Library/Homebrew/os/mac/version.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A macOS version.
Constant Summary collapse
- SYMBOLS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ big_sur: "11.0", catalina: "10.15", mojave: "10.14", high_sierra: "10.13", sierra: "10.12", el_capitan: "10.11", yosemite: "10.10", }.freeze
Constants inherited from Version
Version::NULL, Version::NULL_TOKEN
Class Method Summary collapse
- .from_symbol(sym) ⇒ Object private
Instance Method Summary collapse
- #<=>(other) ⇒ Object private
-
#initialize(value) ⇒ Version
constructor
private
A new instance of Version.
- #pretty_name ⇒ Object private
-
#requires_nehalem_cpu? ⇒ Boolean
(also: #requires_sse4?, #requires_sse41?, #requires_sse42?, #requires_popcnt?)
private
For Version compatibility.
- #to_sym ⇒ Object private
Methods inherited from Version
create, detect, #detected_from_url?, #empty?, formula_optionally_versioned_regex, #hash, #head?, #major, #major_minor, #major_minor_patch, #minor, #null?, parse, #patch, #to_f, #to_i, #to_s
Constructor Details
#initialize(value) ⇒ Version
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Version.
28 29 30 31 32 33 34 |
# File 'Library/Homebrew/os/mac/version.rb', line 28 def initialize(value) super(value) raise MacOSVersionError, value unless value.match?(/\A1\d+(?:\.\d+){0,2}\Z/) @comparison_cache = {} end |
Class Method Details
.from_symbol(sym) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 |
# File 'Library/Homebrew/os/mac/version.rb', line 23 def self.from_symbol(sym) str = SYMBOLS.fetch(sym) { raise MacOSVersionError, sym } new(str) end |
Instance Method Details
#<=>(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 40 41 |
# File 'Library/Homebrew/os/mac/version.rb', line 36 def <=>(other) @comparison_cache.fetch(other) do v = SYMBOLS.fetch(other) { other.to_s } @comparison_cache[other] = super(::Version.new(v)) end end |
#pretty_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'Library/Homebrew/os/mac/version.rb', line 47 def pretty_name to_sym.to_s.split("_").map(&:capitalize).join(" ") end |
#requires_nehalem_cpu? ⇒ Boolean Also known as: requires_sse4?, requires_sse41?, requires_sse42?, requires_popcnt?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
For OS::Mac::Version compatibility.
52 53 54 55 56 57 58 |
# File 'Library/Homebrew/os/mac/version.rb', line 52 def requires_nehalem_cpu? unless Hardware::CPU.intel? raise "Unexpected architecture: #{Hardware::CPU.arch}. This only works with Intel architecture." end Hardware.oldest_cpu(self) == :nehalem end |
#to_sym ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 |
# File 'Library/Homebrew/os/mac/version.rb', line 43 def to_sym SYMBOLS.invert.fetch(@version, :dunno) end |