From: "Sandor Szücs" Date: 2008-12-07T21:15:38+09:00 Subject: [ruby-core:20407] [Bug #835] fix for Documentation on ruby*/lib/benchmark Bug #835: fix for Documentation on ruby*/lib/benchmark http://redmine.ruby-lang.org/issues/show/835 Author: Sandor Sz��cs Status: Open, Priority: Low The example in the documentation of the module Benchmark is not quite correct, because the constants are not defined. We have to add "include Benchmark" to get them. Patch files are attached for ruby 1.8.{6,7} and 1.9. Context: [code] # require 'benchmark' # # n = 50000 # Benchmark.benchmark(" "*7 + CAPTION, 7, FMTSTR, ">total:", ">avg:") do |x| # tf = x.report("for:") { for i in 1..n; a = "1"; end } # tt = x.report("times:") { n.times do ; a = "1"; end } # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } # [tf+tt+tu, (tf+tt+tu)/3] # end ... module Benchmark .. end [/code] ty sandor ---------------------------------------- http://redmine.ruby-lang.org