Class: Aardi::Year
Instance Attribute Summary
Attributes inherited from AbstractBlog
#key
Instance Method Summary
collapse
#metadata, #mtime, #render
Constructor Details
#initialize(key, archive_path) ⇒ Year
Returns a new instance of Year.
5
6
7
8
9
|
# File 'lib/aardi/year.rb', line 5
def initialize(key, archive_path)
@key = key
@archive_path = archive_path
@index = Hash.new { |hash, month| hash[month] = Month.new(self, month, archive_path) }
end
|
Instance Method Details
#<<(post) ⇒ Object
11
12
13
|
# File 'lib/aardi/year.rb', line 11
def <<(post)
@index[post.month] << post
end
|
#archive_row(year_fmt, month_fmt) ⇒ Object
15
16
17
18
|
# File 'lib/aardi/year.rb', line 15
def archive_row(year_fmt, month_fmt)
months_map = (1..12).map { |month| @index[month].archive_cell(month_fmt) }.join
format(year_fmt, year: to_s, months: months_map)
end
|
#content ⇒ Object
20
21
22
|
# File 'lib/aardi/year.rb', line 20
def content
"# #{title}\n#{months.map { |month| month_link(month) }.join("\n")}"
end
|
#target_path ⇒ Object
24
25
26
|
# File 'lib/aardi/year.rb', line 24
def target_path
"./#{@archive_path}/#{self}/index.html"
end
|
#title ⇒ Object
28
|
# File 'lib/aardi/year.rb', line 28
def title = to_s
|