Sha256: 262f09d6325a739c29666a32d3f403bc73fb7a0a3aa8e8436d0deb5a5f99fa2f
Contents?: true
Size: 599 Bytes
Versions: 28
Compression:
Stored size: 599 Bytes
Contents
# -*- encoding: utf-8 -*- module Bluepill class ProcessStatistics STRFTIME = "%m/%d/%Y %H:%I:%S".freeze EVENTS_TO_PERSIST = 10 attr_reader :events # possibly persist this data. def initialize @events = Util::RotationalArray.new(EVENTS_TO_PERSIST) end def record_event(event, reason) events.push([event, reason, Time.now]) end def to_s str = events.reverse.map do |(event, reason, time)| " #{event} at #{time.strftime(STRFTIME)} - #{reason || "unspecified"}" end.join("\n") "event history:\n#{str}" end end end
Version data entries
28 entries across 28 versions & 5 rubygems