module Benchmark
Public Class Methods
pbm(label_width = 0, *labels, &blk)
click to toggle source
# File lib/penchmark/benchmark.rb, line 44 def self.pbm(label_width = 0, *labels, &blk) penchmark(CAPTION, label_width, FORMAT, *labels, &blk) end
penchmark(caption = '', label_width = nil, format = nil, *labels) { |report| ... }
click to toggle source
# File lib/penchmark/benchmark.rb, line 28 def self.penchmark(caption = '', label_width = nil, format = nil, *labels) label_width ||= 0 label_width += 1 format ||= FORMAT print "#{' '*label_width + caption}".blue unless caption.empty? report = ColoredReport.new(label_width, format) results = yield(report) print "#{'-'*label_width}\n".yellow Array === results and results.grep(Tms).each { |t| print((labels.shift || t.label || "").ljust(label_width).yellow, t.format(format.yellow)) } report.list end