Class: Aardi::Tags
Instance Attribute Summary
Attributes inherited from AbstractBlog
#key
Instance Method Summary
collapse
#metadata, #mtime, #render
Constructor Details
#initialize ⇒ Tags
Returns a new instance of Tags.
5
6
7
|
# File 'lib/aardi/tags.rb', line 5
def initialize
@index = Hash.new { |hash, tag| hash[tag] = TagBlog.new(tag) }
end
|
Instance Method Details
#<<(post) ⇒ Object
9
10
11
12
13
|
# File 'lib/aardi/tags.rb', line 9
def <<(post)
post.tags&.each do |tag|
@index[tag] << post
end
end
|
#content ⇒ Object
15
16
17
18
19
|
# File 'lib/aardi/tags.rb', line 15
def content
return "# Tags\n" if counts.empty?
"# Tags\n\n#{tag_lines.join("\n")}\n"
end
|
#empty? ⇒ Boolean
21
|
# File 'lib/aardi/tags.rb', line 21
def empty? = @index.empty?
|
#inline_links ⇒ Object
23
24
25
|
# File 'lib/aardi/tags.rb', line 23
def inline_links
counts.map { |_tag, tag_blog| tag_blog.inline_link_text }.join(', ')
end
|
#target_path ⇒ Object
27
28
29
|
# File 'lib/aardi/tags.rb', line 27
def target_path
"./#{tags_base_path}/index.html"
end
|
#title ⇒ Object
31
|
# File 'lib/aardi/tags.rb', line 31
def title = 'Tags'
|