class Bluepill::ProcessStatistics
Constants
- EVENTS_TO_PERSIST
- STRFTIME
Attributes
events[R]
Public Class Methods
new()
click to toggle source
possibly persist this data.
# File lib/bluepill/process_statistics.rb, line 9 def initialize @events = Util::RotationalArray.new(EVENTS_TO_PERSIST) end
Public Instance Methods
record_event(event, reason)
click to toggle source
# File lib/bluepill/process_statistics.rb, line 13 def record_event(event, reason) events.push([event, reason, Time.now]) end
to_s()
click to toggle source
# File lib/bluepill/process_statistics.rb, line 17 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