Class: Aardi::Day
Overview
:reek:TooManyInstanceVariables
Instance Attribute Summary
Attributes inherited from AbstractBlog
#key
Instance Method Summary
collapse
#metadata, #mtime, #render
Constructor Details
#initialize(year, month, key, archive_path) ⇒ Day
Returns a new instance of Day.
6
7
8
9
10
11
12
|
# File 'lib/aardi/day.rb', line 6
def initialize(year, month, key, archive_path)
@year = year
@month = month
@key = key
@archive_path = archive_path
@posts = []
end
|
Instance Method Details
#<<(post) ⇒ Object
14
15
16
|
# File 'lib/aardi/day.rb', line 14
def <<(post)
@posts << post
end
|
#content ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/aardi/day.rb', line 18
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
26
|
# File 'lib/aardi/day.rb', line 26
def count = @posts.count
|
#target_path ⇒ Object
28
29
30
|
# File 'lib/aardi/day.rb', line 28
def target_path
"./#{@archive_path}/#{@year}/#{@month}/#{self}/index.html"
end
|
#title ⇒ Object
32
|
# File 'lib/aardi/day.rb', line 32
def title = date.strftime('%A, %-e %B %Y')
|