Class: Aardi::Day
Overview
:reek:TooManyInstanceVariables
Instance Attribute Summary
Attributes inherited from AbstractBlog
#key
Instance Method Summary
collapse
#metadata, #mtime, #render, #title
Constructor Details
#initialize(year, month, key, archive_path, tag = nil) ⇒ Day
Returns a new instance of Day.
6
7
8
9
10
11
12
13
|
# File 'lib/aardi/day.rb', line 6
def initialize(year, month, key, archive_path, tag = nil)
@year = year
@month = month
@key = key
@archive_path = archive_path
@tag = tag
@posts = []
end
|
Instance Method Details
#<<(post) ⇒ Object
15
16
17
|
# File 'lib/aardi/day.rb', line 15
def <<(post)
@posts << post
end
|
#content ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/aardi/day.rb', line 19
def content
@content ||= begin
sorted_posts = @posts.sort_by(&:creation)
posts_content = sorted_posts.reverse.map(&:content)
"# #{title}\n#{posts_content.join}"
end
end
|
#count ⇒ Object
27
|
# File 'lib/aardi/day.rb', line 27
def count = @posts.count
|
#target_path ⇒ Object
29
30
31
|
# File 'lib/aardi/day.rb', line 29
def target_path
"./#{@archive_path}/#{@year}/#{@month}/#{self}/index.html"
end
|