Class: JADOF::Post

Inherits:
Page
  • Object
show all
Defined in:
lib/jadof/post.rb

Overview

Represents a blog post. Has the same functionality as Page but with a #date added (which makes #to_param) include a date, in the conventional way: ‘2010/01/31/name-of-post`

Constant Summary

Constants inherited from Page

JADOF::Page::DEFAULT_DIR, JADOF::Page::DEFAULT_FORMATTERS

Instance Attribute Summary collapse

Attributes inherited from Page

#body, #filename, #name, #parent, #path

Attributes included from PageAPI

#cache, #dir, #formatters

Instance Method Summary collapse

Methods inherited from Page

#==, #extensions, #full_name, #initialize, #render, #to_s

Methods included from PageAPI

#[], #all, #cache_for, #count, #first, #from_path, #get, #inherited, #last, #matches_conditions?, #render, #where

Constructor Details

This class inherits a constructor from JADOF::Page

Instance Attribute Details

#dateTime

If a [String] is passed in, it will be parsed as a time.

Returns:

  • (Time)

    the date that this post was created.



12
13
14
# File 'lib/jadof/post.rb', line 12

def date
  @date
end

Instance Method Details

#to_paramString

post urls, eg. ‘2010/01/31/name-of-post`

Returns:

  • (String)

    The conventional way to display blog



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

def to_param
  date ? "#{ date.strftime('%Y/%m/%d') }/#{ full_name }" : super
end