Class: Bluepill::ProcessStatistics
- Inherits:
-
Object
- Object
- Bluepill::ProcessStatistics
- Defined in:
- lib/bluepill/process_statistics.rb
Constant Summary collapse
- STRFTIME =
"%m/%d/%Y %H:%I:%S"
Instance Method Summary collapse
-
#initialize ⇒ ProcessStatistics
constructor
possibly persist this data.
- #record_event(event, reason) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ ProcessStatistics
possibly persist this data.
7 8 9 |
# File 'lib/bluepill/process_statistics.rb', line 7 def initialize @events = Util::RotationalArray.new(10) end |
Instance Method Details
#record_event(event, reason) ⇒ Object
11 12 13 |
# File 'lib/bluepill/process_statistics.rb', line 11 def record_event(event, reason) @events.push([event, reason, Time.now]) end |
#to_s ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/bluepill/process_statistics.rb', line 15 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 |