class Loba::Internal::TimeKeeper

Internal class for tracking time stamps; should not be used directly @!attribute [r] timewas

Previous timestamped Time value

@!attribute [r] timenum

Count of timestamping occurances so far

Attributes

timenum[R]
timewas[R]

Public Class Methods

new() click to toggle source
# File lib/loba/internal/time_keeper.rb, line 14
def initialize
  reset!
end

Public Instance Methods

ping() click to toggle source
# File lib/loba/internal/time_keeper.rb, line 18
def ping
  @timenum += 1
  now = Time.now
  change = now - @timewas
  @timewas = now

  { number: @timenum, now: now, change: change }
end
reset!() click to toggle source
# File lib/loba/internal/time_keeper.rb, line 27
def reset!
  @timewas = Time.now
  @timenum = 0
end