class Benchmark::IPS::Job

def item(label="", str=nil, &blk) # :yield:

Raises:
  • (ArgumentError) - Raises if str and blk are both absent.
  • (ArgumentError) - Raises if str and blk are both present.

Parameters:
  • blk (Proc) -- Code to be benchmarked.
  • str (String) -- Code to be benchmarked.
  • label (String) -- Label of benchmarked code.
def item(label="", str=nil, &blk) # :yield:
  if blk and str
    raise ArgumentError, "specify a block and a str, but not both"
  end
  action = str || blk
  raise ArgumentError, "no block or string" unless action
  @list.push Entry.new(label, action)
  self
end