Sha256: 1d27e7e5875dd3c61a02b3a2fe2eb8efbbde22a86d82e684af6cddaadd759dd3
Contents?: true
Size: 625 Bytes
Versions: 3
Compression:
Stored size: 625 Bytes
Contents
# -*- encoding: utf-8 -*- require 'evented_bluepill/util/rotational_array' module EventedBluepill class ProcessStatistics STRFTIME = "%m/%d/%Y %H:%I:%S" # possibly persist this data. def initialize(size = 10) @events = EventedBluepill::Util::RotationalArray.new(size) end def record_event(event, reason) @events.push([event, reason, Time.now]) end def to_s str = @events.reverse.collect do |(event, reason, time)| str << " #{event} at #{time.strftime(STRFTIME)} - #{reason || "unspecified"}" end.join("\n") "event history:\n#{str}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems