Class: Aardi::Archive
Instance Attribute Summary
Attributes inherited from AbstractBlog
#key
Instance Method Summary
collapse
#metadata, #mtime, #render, #title
Constructor Details
#initialize(archive_path, tag = nil, tags = nil) ⇒ Archive
Returns a new instance of Archive.
5
6
7
8
9
10
|
# File 'lib/aardi/archive.rb', line 5
def initialize(archive_path, tag = nil, tags = nil)
@archive_path = archive_path
@tag = tag
@tags = tags
@index = Hash.new { |hash, year| hash[year] = Year.new(year, @archive_path, @tag) }
end
|
Instance Method Details
#<<(post) ⇒ Object
12
13
14
|
# File 'lib/aardi/archive.rb', line 12
def <<(post)
@index[post.creation.year] << post
end
|
#content ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/aardi/archive.rb', line 16
def content
year_fmt = "| %<year>s | %<months>s \n"
month_fmt = "[ %<count>s ](#{Config[:site_url]}/%<archive_path>s/%<year>s/%<month>s/)"
rows = years.map { |year| year.archive_row(year_fmt, month_fmt) }.join
"#{title_heading}#{tag_list}**When**:\n\n#{}#{rows}"
end
|
#target_path ⇒ Object
24
|
# File 'lib/aardi/archive.rb', line 24
def target_path = "./#{@archive_path}/index.html"
|