Class: JekyllRecker::Entry

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

Overview

Entry

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ Entry

Returns a new instance of Entry.



6
7
8
# File 'lib/jekyll_recker/entry.rb', line 6

def initialize(doc)
  @doc = doc
end

Instance Method Details

#contentObject



10
11
12
# File 'lib/jekyll_recker/entry.rb', line 10

def content
  @doc.content
end

#dateObject



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

def date
  @date ||= ::Date.parse(@doc.date.strftime('%Y-%m-%d'))
end

#word_countObject



25
26
27
# File 'lib/jekyll_recker/entry.rb', line 25

def word_count
  @word_count ||= words.size
end

#wordsObject



18
19
20
21
22
23
# File 'lib/jekyll_recker/entry.rb', line 18

def words
  content.split.map do |token|
    token.gsub!(/[^0-9a-z ]/i, '')
    token.downcase
  end
end