# Benchmark::Job (Class)

In: | benchmark.rb
Parent: | Object

A Job is a sequence of labelled blocks to be processed by the Benchmark.bmbm method. It is of little direct interest to the user.

## Methods

item new report

## Attributes

list | [R] | An array of 2-element arrays, consisting of label and block pairs.
width | [R] | Length of the widest label in the list, plus one.

## Public Class methods

new(width)

Returns an initialized Job instance. Usually, one doesn’t call this method directly, as new Job objects are created by the bmbm method. width is a initial value for the label offset used in formatting; the bmbm method passes its width argument to this constructor.

[Source]

    # File benchmark.rb, line 359
        def initialize(width)
          @width = width
          @list = []
        end

## Public Instance methods

item(label = "") {|| ...}

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

[Source]

    # File benchmark.rb, line 367
        def item(label = "", &blk) # :yield:

          raise ArgmentError, "no block" unless block_given?
          label.concat ' '
          w = label.length
          @width = w if @width < w
          @list.push [label, blk]
          self
        end

report(label = "")

Alias for item

[Validate]