module Pry::Helpers::Platform

Contains methods for querying the platform that Pry is running on @api public @since v0.12.0 rubocop:disable Style/DoubleNegation

Public Class Methods

jruby?() click to toggle source

@return [Boolean]

# File lib/pry/helpers/platform.rb, line 32
def self.jruby?
  RbConfig::CONFIG['ruby_install_name'] == 'jruby'
end
jruby_19?() click to toggle source

@return [Boolean]

# File lib/pry/helpers/platform.rb, line 37
def self.jruby_19?
  jruby? && RbConfig::CONFIG['ruby_version'] == '1.9'
end
linux?() click to toggle source

@return [Boolean]

# File lib/pry/helpers/platform.rb, line 14
def self.linux?
  !!(RbConfig::CONFIG['host_os'] =~ /linux/i)
end
mac_osx?() click to toggle source

@return [Boolean]

# File lib/pry/helpers/platform.rb, line 9
def self.mac_osx?
  !!(RbConfig::CONFIG['host_os'] =~ /\Adarwin/i)
end
mri?() click to toggle source

@return [Boolean]

# File lib/pry/helpers/platform.rb, line 42
def self.mri?
  RbConfig::CONFIG['ruby_install_name'] == 'ruby'
end
mri_19?() click to toggle source

@return [Boolean]

# File lib/pry/helpers/platform.rb, line 47
def self.mri_19?
  !!(mri? && RUBY_VERSION.start_with?('1.9'))
end
mri_2?() click to toggle source

@return [Boolean]

# File lib/pry/helpers/platform.rb, line 52
def self.mri_2?
  !!(mri? && RUBY_VERSION.start_with?('2'))
end
windows?() click to toggle source

@return [Boolean] true when Pry is running on Windows with ANSI support,

false otherwise
# File lib/pry/helpers/platform.rb, line 20
def self.windows?
  !!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/)
end
windows_ansi?() click to toggle source

@return [Boolean]

# File lib/pry/helpers/platform.rb, line 25
def self.windows_ansi?
  return false unless windows?

  !!(defined?(Win32::Console) || ENV['ANSICON'] || mri_2?)
end