Class: MetricFu::FlogGrapher
- Defined in:
- lib/graphs/flog_grapher.rb
Instance Attribute Summary collapse
-
#flog_average ⇒ Object
Returns the value of attribute flog_average.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#top_five_percent_average ⇒ Object
Returns the value of attribute top_five_percent_average.
Instance Method Summary collapse
- #get_metrics(metrics, date) ⇒ Object
- #graph! ⇒ Object
-
#initialize ⇒ FlogGrapher
constructor
A new instance of FlogGrapher.
Methods inherited from Grapher
Constructor Details
#initialize ⇒ FlogGrapher
Returns a new instance of FlogGrapher.
7 8 9 10 11 12 |
# File 'lib/graphs/flog_grapher.rb', line 7 def initialize super self.flog_average = [] self.labels = {} self.top_five_percent_average =[] end |
Instance Attribute Details
#flog_average ⇒ Object
Returns the value of attribute flog_average.
5 6 7 |
# File 'lib/graphs/flog_grapher.rb', line 5 def flog_average @flog_average end |
#labels ⇒ Object
Returns the value of attribute labels.
5 6 7 |
# File 'lib/graphs/flog_grapher.rb', line 5 def labels @labels end |
#top_five_percent_average ⇒ Object
Returns the value of attribute top_five_percent_average.
5 6 7 |
# File 'lib/graphs/flog_grapher.rb', line 5 def top_five_percent_average @top_five_percent_average end |
Instance Method Details
#get_metrics(metrics, date) ⇒ Object
14 15 16 17 18 |
# File 'lib/graphs/flog_grapher.rb', line 14 def get_metrics(metrics, date) self.top_five_percent_average.push(calc_top_five_percent_average(metrics)) self.flog_average.push(metrics[:flog][:average]) self.labels.update( { self.labels.size => date }) end |
#graph! ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/graphs/flog_grapher.rb', line 20 def graph! g = Gruff::Line.new(MetricFu.graph_size) g.title = "Flog: code complexity" g.theme = MetricFu.graph_theme g.font = MetricFu.graph_font g.data('top five percent average', self.top_five_percent_average) g.data('flog average', self.flog_average) 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, 'flog.png')) end |