class Gruf::Timer::Result

Represents a timer result that contains both the elapsed time and the result of the block

result = Timer.time { do_my_thing }
result.time # => 1.10123
result.result # => 'my_thing_is_done'

@property [Object] result The result of the block that was called @property [Float] time The time, in ms, of the block execution

Attributes

result[R]
time[R]

Public Class Methods

new(result, time) click to toggle source

Initialize the result object

@param [Object] result The result of the block that was called @param [Float] time The time, in ms, of the block execution

# File lib/gruf/timer.rb, line 45
def initialize(result, time)
  @result = result
  @time = time.to_f
end

Public Instance Methods

success?() click to toggle source

Was this result a successful result?

@return [Boolean] Whether or not this result was a success

# File lib/gruf/timer.rb, line 55
def success?
  !result.is_a?(GRPC::BadStatus) && !result.is_a?(StandardError) && !result.is_a?(GRPC::Core::CallError)
end