class BenchmarkInterface::RBenchContext

Public Class Methods

new() click to toggle source
# File lib/benchmark-interface/frontends/rbench.rb, line 13
def initialize
  @columns = []
end

Public Instance Methods

column(name, options=nil) click to toggle source
# File lib/benchmark-interface/frontends/rbench.rb, line 21
def column(name, options=nil)
  singleton_class = (class << self; self end)
  singleton_class.class_eval "def #{name}(&block); rbench_benchmark #{name.inspect}, block; end"
  @columns.push name
end
format(options) click to toggle source
# File lib/benchmark-interface/frontends/rbench.rb, line 17
def format(options)
  # Ignore
end
group(name) { |self| ... } click to toggle source
# File lib/benchmark-interface/frontends/rbench.rb, line 27
def group(name)
  @group_name = name
  yield self
ensure
  @group_name = nil
end
rbench_benchmark(column_name, block) click to toggle source
# File lib/benchmark-interface/frontends/rbench.rb, line 49
def rbench_benchmark(column_name, block)
  name = [@group_name, @report_name, column_name].compact.join('-')
  BenchmarkInterface.benchmark name, &block
end
report(name, &block) click to toggle source
# File lib/benchmark-interface/frontends/rbench.rb, line 34
def report(name, &block)
  if @columns.size == 0
    BenchmarkInterface.benchmark name, &block
  else
    @report_name = name
    instance_eval &block
  end
ensure
  @report_name = nil
end
summary(title) click to toggle source
# File lib/benchmark-interface/frontends/rbench.rb, line 45
def summary(title)
  # Ignore
end