Sha256: d2398cafc0c2fc2969f1583f941f5ab8088caebe6ed2f9dd2234348b4240c07c

Contents?: true

Size: 1.39 KB

Versions: 15

Compression:

Stored size: 1.39 KB

Contents

class Pry
  module Helpers
    # Contains methods for querying the platform that Pry is running on
    # @api public
    # @since v0.12.0
    # rubocop:disable Style/DoubleNegation
    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) || 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
    # rubocop:enable Style/DoubleNegation
  end
end

Version data entries

15 entries across 15 versions & 7 rubygems

Version Path
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/helpers/platform.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/helpers/platform.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/pry-0.12.2/lib/pry/helpers/platform.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/helpers/platform.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/helpers/platform.rb
chess_engine-0.0.2 vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/platform.rb
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/platform.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/helpers/platform.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/helpers/platform.rb
pry-0.12.2-java lib/pry/helpers/platform.rb
pry-0.12.2 lib/pry/helpers/platform.rb
pry-0.12.1 lib/pry/helpers/platform.rb
pry-0.12.1-java lib/pry/helpers/platform.rb
pry-0.12.0 lib/pry/helpers/platform.rb
pry-0.12.0-java lib/pry/helpers/platform.rb