Module: Ruff::Standard::MeasureTime

Defined in:
lib/ruff/standard/measure_time.rb

Overview

MeasureTime provides effects MeasureTime.eff , and the implementation to measure and report execution time .

The module has an instance of Instance and provides its methods as module method.

Examples:

MeasureTime.with {
  MeasureTime.measure 'one'
  sleep 1
  MeasureTime.measure 'two'
  sleep 0.1

  return 0
}
#==> [0, {:label=>"two", :time=>0.1}, {:label=>"one", :time=>1.1}]

See Also:

Defined Under Namespace

Classes: Instance

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#effObject (readonly)



76
77
78
# File 'lib/ruff/standard/measure_time.rb', line 76

def eff
  @eff
end

Class Method Details

.measure(label) ⇒ Object



64
65
66
# File 'lib/ruff/standard/measure_time.rb', line 64

def measure(label)
  @inst.measure(label)
end

.with(&th) ⇒ Object



69
70
71
# File 'lib/ruff/standard/measure_time.rb', line 69

def with(&th)
  @inst.with(&th)
end