diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index cfe42a75f51730168ce95e84ec555e037bc30b4c..e19ecae70a5dd18d2c33613c9be870bf01d4a38c 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -16,9 +16,16 @@ module OS new(SYMBOLS.fetch(sym)) end + def initialize(*args) + super + @comparison_cache = {} + end + def <=>(other) - v = SYMBOLS.fetch(other, other.to_s) - super(Version.new(v)) + @comparison_cache.fetch(other) do + v = SYMBOLS.fetch(other, other.to_s) + @comparison_cache[other] = super(Version.new(v)) + end end def to_sym