From dbfc6dc7a5374ffbb1f895df182501e7d931eda5 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 25 Aug 2020 00:01:15 +0200 Subject: [PATCH] Document `OS`. --- Library/Homebrew/os.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index ff739cd20f..4981f12b53 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -1,18 +1,30 @@ # frozen_string_literal: true +# Helper functions for querying operating system information. +# +# @api private module OS + # Check if the operating system is macOS. + # + # @api public def self.mac? return false if ENV["HOMEBREW_TEST_GENERIC_OS"] RbConfig::CONFIG["host_os"].include? "darwin" end + # Check if the operating system is Linux. + # + # @api public def self.linux? return false if ENV["HOMEBREW_TEST_GENERIC_OS"] RbConfig::CONFIG["host_os"].include? "linux" end + # Get the kernel version. + # + # @api public def self.kernel_version @kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp) end