Class: Aardi::Post

Inherits:
AbstractBlog show all
Includes:
AbstractPageSupport
Defined in:
lib/aardi/post.rb

Instance Attribute Summary

Attributes inherited from AbstractBlog

#key

Instance Method Summary collapse

Methods included from AbstractPageSupport

#metadata, #mtime, #parse_source, #title

Methods inherited from AbstractBlog

#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 .creation
end

Instance Method Details

#contentObject



14
15
16
# File 'lib/aardi/post.rb', line 14

def content
  @content ||= "#{@src_content}\n<div>#{PostBookmarkLine.new(self)}</div>\n"
end

#creationObject



18
# File 'lib/aardi/post.rb', line 18

def creation = .creation

#feed_snippetObject



20
21
22
# File 'lib/aardi/post.rb', line 20

def feed_snippet
  @feed_snippet ||= Aardi.renderer.markup_feed_snippet(@src_content)
end

#nameObject



24
# File 'lib/aardi/post.rb', line 24

def name = File.basename(@path, '.*')

#report_field_summaryObject



26
27
28
29
# File 'lib/aardi/post.rb', line 26

def report_field_summary
  creation_header = creation.strftime('%e %b %Y')
  puts "#{creation_header} | #{@path} | #{title}"
end

#tagsObject



31
# File 'lib/aardi/post.rb', line 31

def tags = .tags

#target_pathObject



33
34
35
# File 'lib/aardi/post.rb', line 33

def target_path
  "./#{short_target}.html"
end

#updatedObject



37
# File 'lib/aardi/post.rb', line 37

def updated = .updated || creation

#urlObject



39
# File 'lib/aardi/post.rb', line 39

def url = "#{Config[:site_url]}/#{short_target}"