Sha256: aab634c74225f188c4baa6ff1b6ebe26a2a407a9a54752e98b00e36f78a83abb

Contents?: true

Size: 1.25 KB

Versions: 4508

Compression:

Stored size: 1.25 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?)
      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_2?
        mri? && RUBY_VERSION.start_with?('2')
      end
    end
  end
end

Version data entries

4,508 entries across 4,508 versions & 18 rubygems

Version Path
cybrid_api_bank_ruby-0.57.34 vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/helpers/platform.rb
cybrid_api_id_ruby-0.57.34 vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/helpers/platform.rb
cybrid_api_organization_ruby-0.57.34 vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/helpers/platform.rb
cybrid_api_id_ruby-0.57.33 vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/helpers/platform.rb
cybrid_api_bank_ruby-0.57.33 vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/helpers/platform.rb
cybrid_api_organization_ruby-0.57.33 vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/helpers/platform.rb
pry-0.14.2 lib/pry/helpers/platform.rb
pry-0.14.2-java lib/pry/helpers/platform.rb