Sha256: 6d0451fe83729d9955ea13e4d47706ae02f8bf40b41e33b1bb03c8546bf42fca
Contents?: true
Size: 576 Bytes
Versions: 4
Compression:
Stored size: 576 Bytes
Contents
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.collect do |(event, reason, time)| " #{event} at #{time.strftime(STRFTIME)} - #{reason || 'unspecified'}" end.join("\n") "event history:\n#{str}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems