From 059db269f34b892d82339141989579ab147c4a9b Mon Sep 17 00:00:00 2001 From: Andy Maleh Date: Fri, 5 Aug 2022 13:52:49 -0400 Subject: [PATCH] OS.mac_version (w/ aliases: osx_version & x_version) --- .gitignore | 8 ++++++++ README.md | 3 +++ lib/os.rb | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/.gitignore b/.gitignore index c1e0daf..e0365dc 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,14 @@ tmtags ## VIM *.swp +## GLADIATOR +.gladiator +.gladiator-scratchpad + +## RVM +.ruby-version +.ruby-gemset + ## PROJECT::GENERAL coverage rdoc diff --git a/README.md b/README.md index aea9a01..2cb7748 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ require 'os' >> OS.mac? # or OS.osx? or OS.x? => false +>> OS.mac_version # or OS.osx_version or OS.x_version +=> 12.5 # Monterey + >> OS.dev_null => "NUL" # or "/dev/null" depending on which platform diff --git a/lib/os.rb b/lib/os.rb index c65764d..1d1f6be 100644 --- a/lib/os.rb +++ b/lib/os.rb @@ -132,6 +132,17 @@ def self.x? mac? end + def self.mac_version + `sw_vers -productVersion`.chomp if mac? + end + + def self.osx_version + mac_version + end + + def self.x_version + mac_version + end # amount of memory the current process "is using", in RAM # (doesn't include any swap memory that it may be using, just that in actual RAM)