Class: JekyllRecker::Generators::Stats
- Inherits:
-
Jekyll::Generator
- Object
- Jekyll::Generator
- JekyllRecker::Generators::Stats
- Includes:
- Base
- Defined in:
- lib/jekyll_recker/generators.rb
Overview
Stats Generator
Instance Attribute Summary collapse
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
Methods included from Base
#data_file_target, #generate, #name
Methods included from Math
Methods included from Logging
Methods included from Date
#calculate_streaks, #slice_by_consecutive, #time_to_date
Instance Attribute Details
#site ⇒ Object (readonly)
Returns the value of attribute site.
38 39 40 |
# File 'lib/jekyll_recker/generators.rb', line 38 def site @site end |
Instance Method Details
#crunch ⇒ Object
40 41 42 |
# File 'lib/jekyll_recker/generators.rb', line 40 def crunch generate_stats end |
#generate_stats ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/jekyll_recker/generators.rb', line 44 def generate_stats { 'total_words' => total(site.word_counts), 'average_words' => average(site.word_counts), 'total_posts' => site.entries.size, 'consecutive_posts' => calculate_streaks(site.dates).first['days'], 'swears' => calculate_swears } end |