Method: Benchmark::Job#item

Defined in:
lib/benchmark.rb

#item(label = "", &blk) ⇒ Object Also known as: report

Registers the given label and block pair in the job list.

Raises:

  • (ArgumentError)


363
364
365
366
367
368
369
370
# File 'lib/benchmark.rb', line 363

def item(label = "", &blk) # :yield:
  raise ArgumentError, "no block" unless block_given?
  label = label.to_s
  w = label.length
  @width = w if @width < w
  @list << [label, blk]
  self
end