Class: Metrics::Metrics

Inherits:
Array
  • Object
show all
Defined in:
lib/em-http-metrics.rb,
lib/em-http-metrics/csv.rb

Overview

Metrics storage object

Instance Method Summary collapse

Instance Method Details

#to_csv(sep = ";") ⇒ Object

Dump metrics as a CSV



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/em-http-metrics/csv.rb', line 7

def to_csv sep=";"
  csv = CSV.new "", :col_sep => sep
  first = true
  self.each do |row|
    if first
      csv << row.keys
      first = false
    end
    csv << row.values
  end
  csv
end