Class: MetricFu::StatsGrapher
- Defined in:
- lib/graphs/stats_grapher.rb
Instance Attribute Summary collapse
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#lines_of_code ⇒ Object
Returns the value of attribute lines_of_code.
-
#lines_of_test ⇒ Object
Returns the value of attribute lines_of_test.
Instance Method Summary collapse
- #get_metrics(metrics, date) ⇒ Object
- #graph! ⇒ Object
-
#initialize ⇒ StatsGrapher
constructor
A new instance of StatsGrapher.
Methods inherited from Grapher
Constructor Details
#initialize ⇒ StatsGrapher
Returns a new instance of StatsGrapher.
7 8 9 10 11 12 |
# File 'lib/graphs/stats_grapher.rb', line 7 def initialize super self.lines_of_code = [] self.labels = {} self.lines_of_test =[] end |
Instance Attribute Details
#labels ⇒ Object
Returns the value of attribute labels.
5 6 7 |
# File 'lib/graphs/stats_grapher.rb', line 5 def labels @labels end |
#lines_of_code ⇒ Object
Returns the value of attribute lines_of_code.
5 6 7 |
# File 'lib/graphs/stats_grapher.rb', line 5 def lines_of_code @lines_of_code end |
#lines_of_test ⇒ Object
Returns the value of attribute lines_of_test.
5 6 7 |
# File 'lib/graphs/stats_grapher.rb', line 5 def lines_of_test @lines_of_test end |
Instance Method Details
#get_metrics(metrics, date) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/graphs/stats_grapher.rb', line 14 def get_metrics(metrics, date) if metrics.has_key?(:stats) self.lines_of_test.push(metrics[:stats][:testLOC]) self.lines_of_code.push(metrics[:stats][:codeLOC]) self.labels.update( { self.labels.size => date }) end end |
#graph! ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/graphs/stats_grapher.rb', line 22 def graph! g = Gruff::Line.new(MetricFu.graph_size) g.title = "Stats: Rails project size" g.theme = MetricFu.graph_theme g.font = MetricFu.graph_font g.data('lines of code', self.lines_of_code) g.data('lines of test', self.lines_of_test) 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 MetricFu..call(g) g.write(File.join(MetricFu.output_directory, 'stats.png')) end |