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