Module: JekyllRecker::Generators::Base

Includes:
Date, Logging, Math
Included in:
ImageResize, Stats
Defined in:
lib/jekyll_recker/generators.rb

Overview

Base Generator Functions

Instance Method Summary collapse

Methods included from Math

#average, #total

Methods included from Logging

included, #logger

Methods included from Date

#calculate_streaks, #slice_by_consecutive

Instance Method Details

#bodiesObject



26
27
28
# File 'lib/jekyll_recker/generators.rb', line 26

def bodies
  entries.collect(&:content)
end

#datesObject



34
35
36
# File 'lib/jekyll_recker/generators.rb', line 34

def dates
  entries.collect(&:date).map { |t| ::Date.new(t.year, t.month, t.day) }
end

#entriesObject



30
31
32
# File 'lib/jekyll_recker/generators.rb', line 30

def entries
  @site.posts.docs.select(&:published?).sort_by(&:date).reverse
end

#production?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/jekyll_recker/generators.rb', line 14

def production?
  ENV['JEKYLL_ENV'] == 'production'
end

#word_countsObject



18
19
20
# File 'lib/jekyll_recker/generators.rb', line 18

def word_counts
  @word_counts ||= bodies.map(&:split).map(&:size)
end

#wordsObject



22
23
24
# File 'lib/jekyll_recker/generators.rb', line 22

def words
  bodies.map(&:split).flatten
end