Class: Timify::Trace

Inherits:
Object
  • Object
show all
Defined in:
lib/timify/trace.rb

Overview

Result of trace: the block's return value and the timer used to measure it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, timer:) ⇒ Trace

Returns a new instance of Trace.

Parameters:

  • value (Object)
  • timer (Timify)


14
15
16
17
# File 'lib/timify/trace.rb', line 14

def initialize(value:, timer:)
  @value = value
  @timer = timer
end

Instance Attribute Details

#timer ⇒ Timify (readonly)

Returns the timer created for the block.

Returns:

  • (Timify) —

    the timer created for the block



10
11
12
# File 'lib/timify/trace.rb', line 10

def timer
  @timer
end

#value ⇒ Object (readonly)

Returns the block's return value.

Returns:

  • (Object) —

    the block's return value



7
8
9
# File 'lib/timify/trace.rb', line 7

def value
  @value
end

Instance Method Details

#totals(**options) ⇒ Hash, String

Delegates to Timify#totals on #timer.

Parameters:

Returns:

  • (Hash, String)


23
24
25
# File 'lib/timify/trace.rb', line 23

def totals(**options)
  @timer.totals(**options)
end