Class: Adhearsion::Statistics::Dump

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/adhearsion/statistics.rb

Overview

A point-time dump of process statistics

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Dump

Returns a new instance of Dump.



117
118
119
120
121
# File 'lib/adhearsion/statistics.rb', line 117

def initialize(opts = {})
  @timestamp = opts[:timestamp]
  @call_counts = opts[:call_counts]
  @calls_by_route = opts[:calls_by_route]
end

Instance Attribute Details

#call_countsHash

Returns hash of call counts during the lifetime of the process.

Returns:

  • (Hash)

    hash of call counts during the lifetime of the process.



110
111
112
# File 'lib/adhearsion/statistics.rb', line 110

def call_counts
  @call_counts
end

#calls_by_routeHash

Returns hash of call counts during the lifetime of the process, indexed by the route they matched.

Returns:

  • (Hash)

    hash of call counts during the lifetime of the process, indexed by the route they matched.



115
116
117
# File 'lib/adhearsion/statistics.rb', line 115

def calls_by_route
  @calls_by_route
end

#timestampTime

Returns the time at which this dump was generated.

Returns:

  • (Time)

    the time at which this dump was generated



105
106
107
# File 'lib/adhearsion/statistics.rb', line 105

def timestamp
  @timestamp
end

Instance Method Details

#<=>(other) ⇒ Object



123
124
125
# File 'lib/adhearsion/statistics.rb', line 123

def <=>(other)
  timestamp <=> other.timestamp
end

#to_sObject Also known as: inspect



127
128
129
130
131
132
# File 'lib/adhearsion/statistics.rb', line 127

def to_s
  attrs = [:timestamp, :call_counts, :calls_by_route].map do |attr|
    "#{attr}=#{send(attr).inspect}"
  end
  "#<#{self.class} #{attrs.join ', '}>"
end