Class: Yuzu::PostProcessors::RecentPostsPostProcessor

Inherits:
PostProcessor show all
Defined in:
lib/yuzu/postprocessors/recent_posts.rb

Instance Attribute Summary

Attributes inherited from PostProcessor

#name

Instance Method Summary collapse

Methods inherited from PostProcessor

#match, postprocessors, registry

Constructor Details

#initializeRecentPostsPostProcessor

Returns a new instance of RecentPostsPostProcessor.



6
7
8
# File 'lib/yuzu/postprocessors/recent_posts.rb', line 6

def initialize
  @name = :recent_posts
end

Instance Method Details

#get_value(website_file) ⇒ Object



18
19
20
21
22
# File 'lib/yuzu/postprocessors/recent_posts.rb', line 18

def get_value(website_file)
  processable = website_file.blog_folder.all_processable_children
  user_authored = processable.reject {|file| file.generated? or file.index?}
  user_authored.sort {|a, b| b.modified_at <=> a.modified_at}[0...10]
end

#regexObject



10
11
# File 'lib/yuzu/postprocessors/recent_posts.rb', line 10

def regex
end

#value(website_file) ⇒ Object



13
14
15
16
# File 'lib/yuzu/postprocessors/recent_posts.rb', line 13

def value(website_file)
  # Only one set of recent posts per site, so we can cache this.
  @value ||= get_value(website_file)
end