Class: MetricFu::StatsGrapher

Inherits:
Grapher
  • Object
show all
Defined in:
lib/metric_fu/metrics/stats/grapher.rb

Instance Attribute Summary collapse

Attributes inherited from Grapher

#output_directory

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Grapher

#date, get_grapher, #graph!, graphers

Constructor Details

#initializeStatsGrapher

Returns a new instance of StatsGrapher.



10
11
12
13
14
15
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 10

def initialize
  super
  self.loc_counts = []
  self.lot_counts = []
  self.labels = {}
end

Instance Attribute Details

#labelsObject

Returns the value of attribute labels.



4
5
6
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 4

def labels
  @labels
end

#loc_countsObject

Returns the value of attribute loc_counts.



4
5
6
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 4

def loc_counts
  @loc_counts
end

#lot_countsObject

Returns the value of attribute lot_counts.



4
5
6
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 4

def lot_counts
  @lot_counts
end

Class Method Details

.metricObject



6
7
8
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 6

def self.metric
  :stats
end

Instance Method Details

#dataObject



29
30
31
32
33
34
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 29

def data
  [
    ["LOC", @loc_counts.join(",")],
    ["LOT", @lot_counts.join(",")],
  ]
end

#get_metrics(metrics, date) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 17

def get_metrics(metrics, date)
  if metrics && metrics[:stats]
    loc_counts.push(metrics[:stats][:codeLOC].to_i)
    lot_counts.push(metrics[:stats][:testLOC].to_i)
    labels.update(labels.size => date)
  end
end

#output_filenameObject



36
37
38
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 36

def output_filename
  "stats.js"
end

#titleObject



25
26
27
# File 'lib/metric_fu/metrics/stats/grapher.rb', line 25

def title
  "Stats: LOC & LOT"
end