class RBench::Report
def initialize(runner, group, name, times=nil,&block)
def initialize(runner, group, name, times=nil,&block) @runner = runner @group = group @name = name @times = (times || runner.times).ceil @cells = {} @block = block # Setting the default for all cells runner.columns.each {|c| @cells[c.name] = c.name == :times ? "x#{@times}" : c.default } new_self = (class << self; self end) @runner.columns.each do |column| new_self.class_eval <<-CLASS def #{column.name}(val=nil,&block) @cells[#{column.name.inspect}] = block ? Benchmark.measure { @times.times(&block) }.real : val end CLASS end end