Class: Bundler::CurrentRuby

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/current_ruby.rb

Constant Summary collapse

KNOWN_MINOR_VERSIONS =
%w[
  1.8
  1.9
  2.0
  2.1
  2.2
  2.3
  2.4
  2.5
  2.6
  2.7
  3.0
  3.1
].freeze
KNOWN_MAJOR_VERSIONS =
KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
KNOWN_PLATFORMS =
%w[
  jruby
  maglev
  mingw
  mri
  mswin
  mswin64
  rbx
  ruby
  truffleruby
  x64_mingw
].freeze

Instance Method Summary collapse

Instance Method Details

#jruby?Boolean

Returns:

  • (Boolean)

56
57
58
# File 'lib/bundler/current_ruby.rb', line 56

def jruby?
  RUBY_ENGINE == "jruby"
end

#maglev?Boolean

Returns:

  • (Boolean)

60
61
62
# File 'lib/bundler/current_ruby.rb', line 60

def maglev?
  RUBY_ENGINE == "maglev"
end

#mingw?Boolean

Returns:

  • (Boolean)

76
77
78
# File 'lib/bundler/current_ruby.rb', line 76

def mingw?
  Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
end

#mri?Boolean

Returns:

  • (Boolean)

48
49
50
# File 'lib/bundler/current_ruby.rb', line 48

def mri?
  !mswin? && RUBY_ENGINE == "ruby"
end

#mswin64?Boolean

Returns:

  • (Boolean)

72
73
74
# File 'lib/bundler/current_ruby.rb', line 72

def mswin64?
  Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
end

#mswin?Boolean

Returns:

  • (Boolean)

68
69
70
# File 'lib/bundler/current_ruby.rb', line 68

def mswin?
  Gem.win_platform?
end

#rbx?Boolean

Returns:

  • (Boolean)

52
53
54
# File 'lib/bundler/current_ruby.rb', line 52

def rbx?
  ruby? && RUBY_ENGINE == "rbx"
end

#ruby?Boolean

Returns:

  • (Boolean)

42
43
44
45
46
# File 'lib/bundler/current_ruby.rb', line 42

def ruby?
  return true if Bundler::GemHelpers.generic_local_platform == Gem::Platform::RUBY

  !mswin? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
end

#truffleruby?Boolean

Returns:

  • (Boolean)

64
65
66
# File 'lib/bundler/current_ruby.rb', line 64

def truffleruby?
  RUBY_ENGINE == "truffleruby"
end

#x64_mingw?Boolean

Returns:

  • (Boolean)

80
81
82
# File 'lib/bundler/current_ruby.rb', line 80

def x64_mingw?
  Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu == "x64"
end