End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Gem.ruby_version
ruby_version
lib/rubygems.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/rubygems.rb, line 881
def self.ruby_version
return @ruby_version if defined? @ruby_version
version = RUBY_VERSION.dup
if defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL != -1
version << ".#{RUBY_PATCHLEVEL}"
elsif defined?(RUBY_DESCRIPTION)
if RUBY_ENGINE == "ruby"
desc = RUBY_DESCRIPTION[/\Aruby #{Regexp.quote(RUBY_VERSION)}([^ ]+) /, 1]
else
desc = RUBY_DESCRIPTION[/\A#{RUBY_ENGINE} #{Regexp.quote(RUBY_ENGINE_VERSION)} \(#{RUBY_VERSION}([^ ]+)\) /, 1]
end
version << ".#{desc}" if desc
end
@ruby_version = Gem::Version.new version
end
A Gem::Version for the currently running Ruby.
See also
.rubygems_version
.source_date_epoch
.ruby_engine
.source_date_epoch_string
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1