lib/loba/internal/time_keeper.rb in loba-1.2.1 vs lib/loba/internal/time_keeper.rb in loba-2.0.0
- old
+ new
@@ -13,21 +13,30 @@
def initialize
reset!
end
+ # Increments timestamping, including attributes `timenum` and `timewas`
+ # @return [Hash] timestamp details
+ # * :number => [Integer] incremented count of pings so far (attribute `timenum`)
+ # * :now => [Time] current date and time
+ # * :change => [Float] difference in seconds from any previous ping or reset
def ping
@timenum += 1
now = Time.now
change = now - @timewas
@timewas = now
{ number: @timenum, now: now, change: change }
end
+ # Resets timestamping
+ # @return [NilClass] nil
def reset!
@timewas = Time.now
@timenum = 0
+
+ nil
end
end
end
end