Class: MetricFu::RcovGrapher

Inherits:
Grapher
  • Object
show all
Defined in:
lib/graphs/rcov_grapher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Grapher

require_gruff

Constructor Details

#initializeRcovGrapher

Returns a new instance of RcovGrapher.



7
8
9
10
11
# File 'lib/graphs/rcov_grapher.rb', line 7

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

Instance Attribute Details

#labelsObject

Returns the value of attribute labels.



5
6
7
# File 'lib/graphs/rcov_grapher.rb', line 5

def labels
  @labels
end

#rcov_percentObject

Returns the value of attribute rcov_percent.



5
6
7
# File 'lib/graphs/rcov_grapher.rb', line 5

def rcov_percent
  @rcov_percent
end

Instance Method Details

#get_metrics(metrics, date) ⇒ Object



13
14
15
16
# File 'lib/graphs/rcov_grapher.rb', line 13

def get_metrics(metrics, date)
  self.rcov_percent.push(metrics[:rcov][:global_percent_run])
  self.labels.update( { self.labels.size => date })
end

#graph!Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/graphs/rcov_grapher.rb', line 18

def graph!
  g = Gruff::Line.new(MetricFu.graph_size)
  g.title = "Rcov: code coverage"
  g.theme = MetricFu.graph_theme
  g.font = MetricFu.graph_font
  g.data('rcov', self.rcov_percent)
  g.labels = self.labels
  g.title_font_size = MetricFu.graph_title_font_size
  g.legend_box_size = MetricFu.graph_legend_box_size
  g.legend_font_size = MetricFu.graph_legend_font_size
  g.marker_font_size = MetricFu.graph_marker_font_size
  g.write(File.join(MetricFu.output_directory, 'rcov.png'))
end