1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

add linux? & mac_osx? predicates to BaseHelpers (#1668)

* add linux? and mac_osx? predicates to BaseHelpers
* update documentation
This commit is contained in:
r-obert 2017-10-22 17:07:47 +02:00 committed by GitHub
parent b1e76dd4d2
commit 1f32f89ae6
2 changed files with 38 additions and 2 deletions

View file

@ -1,3 +1,10 @@
### HEAD
__Features:__
* Add mac_osx? and linux? utility functions to Pry::Helpers::BaseHelpers.
[#1668](https://github.com/pry/pry/pull/1668)
### 0.11.0
* Add alias 'whereami[?!]+' for 'whereami' command. ([#1597](https://github.com/pry/pry/pull/1597))

View file

@ -60,9 +60,38 @@ class Pry
"\e[1m#{text}\e[0m"
end
# have fun on the Windows platform.
#
# @return [Boolean]
# Returns true if Pry is running on Mac OSX.
#
# @note
# Queries RbConfig::CONFIG['host_os'] with a best guess.
#
def mac_osx?
!!(RbConfig::CONFIG['host_os'] =~ /\Adarwin/i)
end
#
# @return [Boolean]
# Returns true if Pry is running on Linux.
#
# @note
# Queries RbConfig::CONFIG['host_os'] with a best guess.
#
#
def linux?
!!(RbConfig::CONFIG['host_os'] =~ /linux/i)
end
#
# @return [Boolean]
# Returns true if Pry is running on Windows.
#
# @note
# Queries RbConfig::CONFIG['host_os'] with a best guess.
#
def windows?
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
!!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/)
end
# are we able to use ansi on windows?