class Benchmark::ColoredReport
Attributes
list[R]
Public Class Methods
new(width = 0, format = nil)
click to toggle source
# File lib/penchmark/benchmark.rb, line 5 def initialize(width = 0, format = nil) @width, @format, @list = width, format, [] end
Public Instance Methods
item(label = "", min_value = 0.0, max_value = 1.1, *format) { || ... }
click to toggle source
# File lib/penchmark/benchmark.rb, line 9 def item(label = "", min_value = 0.0, max_value = 1.1, *format, &blk) # :yield: @list << res = Benchmark.measure(label, &blk) real_value = res.real if real_value > min_value and real_value < max_value print label.to_s.ljust(@width).green print res.format(@format, *format).green else print label.to_s.ljust(@width).red print res.format(@format, *format).red end res end
Also aliased as: report