module Pry::Platform
Public Instance Methods
jruby?()
click to toggle source
@return [Boolean]
Returns true when Pry is being run from JRuby.
# File lib/pry/platform.rb, line 52 def jruby? RbConfig::CONFIG['ruby_install_name'] == 'jruby' end
jruby_19?()
click to toggle source
@return [Boolean]
Returns true when Pry is being run from JRuby in 1.9 mode.
# File lib/pry/platform.rb, line 60 def jruby_19? jruby? and RbConfig::CONFIG['ruby_version'] == '1.9' end
linux?()
click to toggle source
@return [Boolean]
Returns true if Pry is running on Linux.
@note
Queries RbConfig::CONFIG['host_os'] with a best guess.
# File lib/pry/platform.rb, line 23 def linux? !!(RbConfig::CONFIG['host_os'] =~ /linux/i) end
mac_osx?()
click to toggle source
@return [Boolean]
Returns true if Pry is running on Mac OSX.
@note
Queries RbConfig::CONFIG['host_os'] with a best guess.
# File lib/pry/platform.rb, line 12 def mac_osx? !!(RbConfig::CONFIG['host_os'] =~ /\Adarwin/i) end
mri?()
click to toggle source
@return [Boolean]
Returns true when Pry is being run from MRI (CRuby).
# File lib/pry/platform.rb, line 68 def mri? RbConfig::CONFIG['ruby_install_name'] == 'ruby' end
mri_19?()
click to toggle source
@return [Boolean]
Returns true when Pry is being run from MRI v1.9+ (CRuby).
# File lib/pry/platform.rb, line 76 def mri_19? !!(mri? and RUBY_VERSION =~ /\A1\.9/) end
mri_2?()
click to toggle source
@return [Boolean]
Returns true when Pry is being run from MRI v2+ (CRuby).
# File lib/pry/platform.rb, line 84 def mri_2? !!(mri? and RUBY_VERSION =~ /\A2/) end
windows?()
click to toggle source
@return [Boolean]
Returns true if Pry is running on Windows.
@note
Queries RbConfig::CONFIG['host_os'] with a best guess.
# File lib/pry/platform.rb, line 34 def windows? !!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/) end
windows_ansi?()
click to toggle source
@return [Boolean]
Returns true when Pry is running on Windows with ANSI support.
# File lib/pry/platform.rb, line 42 def windows_ansi? return false if not windows? !!(defined?(Win32::Console) or ENV['ANSICON'] or mri_2?) end