Class: JekyllRecker::Graphs::Swears

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

Overview

Swears Chart

Instance Attribute Summary collapse

Attributes included from Base

#site

Instance Method Summary collapse

Methods included from Base

#graphs_join

Constructor Details

#initialize(site) ⇒ Swears

Returns a new instance of Swears.



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

def initialize(site)
  @results = site.data['stats']['swears'].clone
  @results.delete('total')
  @graphs_dir = site.graphs_dir
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



69
70
71
# File 'lib/jekyll_recker/graphs.rb', line 69

def results
  @results
end

Instance Method Details

#writeObject



77
78
79
80
81
82
83
84
85
# File 'lib/jekyll_recker/graphs.rb', line 77

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