Sha256: f08102ac2ce9789636a88c932d95b10a0226a6d5156dcae5aba568e09874b645
Contents?: true
Size: 680 Bytes
Versions: 3
Compression:
Stored size: 680 Bytes
Contents
require 'singleton' module Loba module Internal # 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 class TimeKeeper include Singleton attr_reader :timewas, :timenum def initialize reset! end def ping @timenum += 1 now = Time.now change = now - @timewas @timewas = now { number: @timenum, now: now, change: change } end def reset! @timewas = Time.now @timenum = 0 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
loba-1.2.1 | lib/loba/internal/time_keeper.rb |
loba-1.1.0 | lib/loba/internal/time_keeper.rb |
loba-1.0.0 | lib/loba/internal/time_keeper.rb |