Skip to content

OS.mac_version (w/ aliases: osx_version & x_version) #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ tmtags
## VIM
*.swp

## GLADIATOR
.gladiator
.gladiator-scratchpad

## RVM
.ruby-version
.ruby-gemset

## PROJECT::GENERAL
coverage
rdoc
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions lib/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down