Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Gem.time
time(msg, width = 0, display = Gem.configuration.verbose) { || ... }
lib/rubygems.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/rubygems.rb, line 956
def self.time(msg, width = 0, display = Gem.configuration.verbose)
now = Time.now
value = yield
elapsed = Time.now - now
ui.say format("%2$*1$s: %3$3.3fs", -width, msg, elapsed) if display
value
end
Prints the amount of time the supplied block takes to run using the debug UI output.