Sha256: 08c9ad059f0818b25e330cc5702724c8c2cc80feeeb8c56ab15e31021db2ae95

Contents?: true

Size: 1.36 KB

Versions: 2288

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

require 'rbconfig'

class Pry
  module Helpers
    # Contains methods for querying the platform that Pry is running on
    # @api public
    # @since v0.12.0
    module Platform
      # @return [Boolean]
      def self.mac_osx?
        !!(RbConfig::CONFIG['host_os'] =~ /\Adarwin/i)
      end

      # @return [Boolean]
      def self.linux?
        !!(RbConfig::CONFIG['host_os'] =~ /linux/i)
      end

      # @return [Boolean] true when Pry is running on Windows with ANSI support,
      #   false otherwise
      def self.windows?
        !!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/)
      end

      # @return [Boolean]
      def self.windows_ansi?
        return false unless windows?

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

      # @return [Boolean]
      def self.jruby?
        RbConfig::CONFIG['ruby_install_name'] == 'jruby'
      end

      # @return [Boolean]
      def self.jruby_19?
        jruby? && RbConfig::CONFIG['ruby_version'] == '1.9'
      end

      # @return [Boolean]
      def self.mri?
        RbConfig::CONFIG['ruby_install_name'] == 'ruby'
      end

      # @return [Boolean]
      def self.mri_19?
        mri? && RUBY_VERSION.start_with?('1.9')
      end

      # @return [Boolean]
      def self.mri_2?
        mri? && RUBY_VERSION.start_with?('2')
      end
    end
  end
end

Version data entries

2,288 entries across 2,284 versions & 21 rubygems

Version Path
ory-hydra-client-2.1.1 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-hydra-client-2.1.0 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.24 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.23 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.22 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-oathkeeper-client-0.40.2 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.21 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.20 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.19 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.18 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
primary_connect_proto-0.20.0 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
primary_connect_proto-0.20.0 vendor/bundle/ruby/3.0.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-keto-client-0.11.0.alpha0 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
mux_ruby-3.9.0 vendor/bundle/ruby/3.2.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
primary_connect_proto-0.19.0 vendor/bundle/ruby/3.0.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.17 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.16 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.15 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.14 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb
ory-client-1.1.13 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/helpers/platform.rb