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
  3.2
  3.3
].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
  windows
  x64_mingw
].freeze

Instance Method Summary collapse

Instance Method Details

#jruby?Boolean

Returns:

  • (Boolean)


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

def jruby?
  RUBY_ENGINE == "jruby"
end

#maglev?Boolean

Returns:

  • (Boolean)


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

def maglev?
  RUBY_ENGINE == "maglev"
end

#mingw?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/bundler/current_ruby.rb', line 87

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

#mri?Boolean

Returns:

  • (Boolean)


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

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

#mswin64?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/bundler/current_ruby.rb', line 83

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

#mswin?Boolean

Returns:

  • (Boolean)


75
76
77
78
79
80
81
# File 'lib/bundler/current_ruby.rb', line 75

def mswin?
  # For backwards compatibility
  windows?

  # TODO: This should correctly be:
  # windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin32" && Bundler.local_platform.cpu == "x86"
end

#rbx?Boolean

Returns:

  • (Boolean)


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

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

#ruby?Boolean

Returns:

  • (Boolean)


45
46
47
48
49
# File 'lib/bundler/current_ruby.rb', line 45

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

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

#truffleruby?Boolean

Returns:

  • (Boolean)


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

def truffleruby?
  RUBY_ENGINE == "truffleruby"
end

#windows?Boolean

Returns:

  • (Boolean)


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

def windows?
  Gem.win_platform?
end

#x64_mingw?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/bundler/current_ruby.rb', line 91

def x64_mingw?
  Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os.start_with?("mingw") && Bundler.local_platform.cpu == "x64"
end