Class: JekyllRecker::Graphs::Swears

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

Overview

Swears Chart

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results, graphs_dir) ⇒ Swears

Returns a new instance of Swears.



58
59
60
61
# File 'lib/jekyll_recker/graphs.rb', line 58

def initialize(results, graphs_dir)
  @results = results
  @graphs_dir = graphs_dir
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



56
57
58
# File 'lib/jekyll_recker/graphs.rb', line 56

def results
  @results
end

Instance Method Details

#graphs_join(path) ⇒ Object

TODO: I SUCK



64
65
66
# File 'lib/jekyll_recker/graphs.rb', line 64

def graphs_join(path)
  File.join Bundler.root, @graphs_dir, path
end

#writeObject



68
69
70
71
72
73
74
75
76
# File 'lib/jekyll_recker/graphs.rb', line 68

def write
  g = Gruff::Pie.new('800x600')
  g.theme = Gruff::Themes::PASTEL
  g.hide_legend = false
  g.legend_at_bottom = true
  g.minimum_value = 0
  results.each { |w, n| g.data w, n }
  g.write(graphs_join('swears.png'))
end