Class: Bundler::CurrentRuby
- Inherits:
-
Object
- Object
- Bundler::CurrentRuby
- Defined in:
- lib/bundler/current_ruby.rb
Constant Summary collapse
- ALL_RUBY_VERSIONS =
(18..27).to_a.concat((30..35).to_a).freeze
- KNOWN_MINOR_VERSIONS =
ALL_RUBY_VERSIONS.map {|v| v.digits.reverse.join(".") }.freeze
- KNOWN_MAJOR_VERSIONS =
ALL_RUBY_VERSIONS.map {|v| v.digits.last.to_s }.uniq.freeze
- PLATFORM_MAP =
{ ruby: [Gem::Platform::RUBY, CurrentRuby::ALL_RUBY_VERSIONS], mri: [Gem::Platform::RUBY, CurrentRuby::ALL_RUBY_VERSIONS], rbx: [Gem::Platform::RUBY], truffleruby: [Gem::Platform::RUBY], jruby: [Gem::Platform::JAVA, [18, 19]], windows: [Gem::Platform::WINDOWS, CurrentRuby::ALL_RUBY_VERSIONS], # deprecated mswin: [Gem::Platform::MSWIN, CurrentRuby::ALL_RUBY_VERSIONS], mswin64: [Gem::Platform::MSWIN64, CurrentRuby::ALL_RUBY_VERSIONS - [18]], mingw: [Gem::Platform::UNIVERSAL_MINGW, CurrentRuby::ALL_RUBY_VERSIONS], x64_mingw: [Gem::Platform::UNIVERSAL_MINGW, CurrentRuby::ALL_RUBY_VERSIONS - [18, 19]], }.each_with_object({}) do |(platform, spec), hash| hash[platform] = spec[0] spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] } end.freeze
Instance Method Summary collapse
- #jruby? ⇒ Boolean
- #maglev? ⇒ Boolean
- #mri? ⇒ Boolean
- #rbx? ⇒ Boolean
- #ruby? ⇒ Boolean
- #truffleruby? ⇒ Boolean
- #windows? ⇒ Boolean (also: #mswin?, #mswin64?, #mingw?, #x64_mingw?)
Instance Method Details
#jruby? ⇒ Boolean
48 49 50 |
# File 'lib/bundler/current_ruby.rb', line 48 def jruby? RUBY_ENGINE == "jruby" end |
#maglev? ⇒ Boolean
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/bundler/current_ruby.rb', line 52 def maglev? = "`CurrentRuby#maglev?` is deprecated with no replacement. Please use the " \ "built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on." = "`CurrentRuby#maglev?` was removed with no replacement. Please use the " \ "built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on." internally_exempted = caller_locations(1, 1).first.path == __FILE__ unless internally_exempted SharedHelpers.major_deprecation(2, , removed_message: , print_caller_location: true) end RUBY_ENGINE == "maglev" end |
#mri? ⇒ Boolean
40 41 42 |
# File 'lib/bundler/current_ruby.rb', line 40 def mri? !windows? && RUBY_ENGINE == "ruby" end |
#rbx? ⇒ Boolean
44 45 46 |
# File 'lib/bundler/current_ruby.rb', line 44 def rbx? ruby? && RUBY_ENGINE == "rbx" end |
#ruby? ⇒ Boolean
34 35 36 37 38 |
# File 'lib/bundler/current_ruby.rb', line 34 def ruby? return true if Bundler::MatchPlatform.generic_local_platform_is_ruby? !windows? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby") end |
#truffleruby? ⇒ Boolean
68 69 70 |
# File 'lib/bundler/current_ruby.rb', line 68 def truffleruby? RUBY_ENGINE == "truffleruby" end |
#windows? ⇒ Boolean Also known as: mswin?, mswin64?, mingw?, x64_mingw?
72 73 74 |
# File 'lib/bundler/current_ruby.rb', line 72 def windows? Gem.win_platform? end |