Class: Aardi::Post
Instance Attribute Summary
Attributes inherited from AbstractBlog
#key
Instance Method Summary
collapse
#metadata, #mtime, #parse_source, #title
#metadata, #mtime, #render, #title
Constructor Details
#initialize(path) ⇒ Post
Returns a new instance of Post.
7
8
9
10
11
12
|
# File 'lib/aardi/post.rb', line 7
def initialize(path)
@path = path
parse_source path
raise "#{path}: missing Creation metadata" unless metadata.creation
end
|
Instance Method Details
#content ⇒ Object
14
15
16
|
# File 'lib/aardi/post.rb', line 14
def content
@content ||= "#{@src_content}\n<div>#{PostBookmarkLine.new(self)}</div>\n"
end
|
#creation ⇒ Object
18
|
# File 'lib/aardi/post.rb', line 18
def creation = metadata.creation
|
#feed_snippet ⇒ Object
20
21
22
|
# File 'lib/aardi/post.rb', line 20
def feed_snippet
@feed_snippet ||= Aardi.renderer.markup_feed_snippet(@src_content)
end
|
#name ⇒ Object
24
|
# File 'lib/aardi/post.rb', line 24
def name = File.basename(@path, '.*')
|
#report_field_summary ⇒ Object
26
27
28
29
|
# File 'lib/aardi/post.rb', line 26
def report_field_summary
= creation.strftime('%e %b %Y')
puts "#{} | #{@path} | #{title}"
end
|
31
|
# File 'lib/aardi/post.rb', line 31
def tags = metadata.tags
|
#target_path ⇒ Object
33
34
35
|
# File 'lib/aardi/post.rb', line 33
def target_path
"./#{short_target}.html"
end
|
#updated ⇒ Object
37
|
# File 'lib/aardi/post.rb', line 37
def updated = metadata.updated || creation
|
#url ⇒ Object
39
|
# File 'lib/aardi/post.rb', line 39
def url = "#{Config[:site_url]}/#{short_target}"
|