Class: MetricFu::RoodiGrapher

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Grapher

require_gruff

Constructor Details

#initializeRoodiGrapher

Returns a new instance of RoodiGrapher.



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

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

Instance Attribute Details

#labelsObject

Returns the value of attribute labels.



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

def labels
  @labels
end

#roodi_countObject

Returns the value of attribute roodi_count.



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

def roodi_count
  @roodi_count
end

Instance Method Details

#get_metrics(metrics, date) ⇒ Object



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

def get_metrics(metrics, date)
  self.roodi_count.push(metrics[:roodi][:problems].size)
  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/roodi_grapher.rb', line 18

def graph!
  g = Gruff::Line.new(MetricFu.graph_size)
  g.title = "Roodi: design problems"
  g.theme = MetricFu.graph_theme
  g.font = MetricFu.graph_font
  g.data('roodi', self.roodi_count)
  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, 'roodi.png'))
end