Class: Rog::Post
- Inherits:
-
Rote::Page
- Object
- Rote::Page
- Rog::Post
- Includes:
- Comparable
- Defined in:
- lib/rog/post.rb
Instance Attribute Summary collapse
-
#day ⇒ Object
readonly
Returns the value of attribute day.
-
#month ⇒ Object
readonly
Returns the value of attribute month.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #date ⇒ Object
-
#initialize(path, blog_path = 'blog', pages_path = "#{blog_path}/pages", posts_path = "#{pages_path}/posts") ⇒ Post
constructor
A new instance of Post.
- #path ⇒ Object
- #tags ⇒ Object
- #url ⇒ Object
Methods inherited from Rote::Page
Constructor Details
#initialize(path, blog_path = 'blog', pages_path = "#{blog_path}/pages", posts_path = "#{pages_path}/posts") ⇒ Post
Returns a new instance of Post.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rog/post.rb', line 28 def initialize(path, blog_path='blog', pages_path="#{blog_path}/pages", posts_path="#{pages_path}/posts") path =~ /(\d\d\d\d)(\d\d)(\d\d)[-].*\.thtml$/ @year, @month, @day = $1, $2, $3 @page_path = path super(path, posts_path, "#{blog_path}/layouts") do |page| relpath = path.sub(/\..*$/,'.html') # genera il nome della pagina formattata @page_url = relpath page.instance_eval("@page_name = '#{relpath}'") # e istanzia una variabile di pagina page.instance_eval("@post_date = '#{@year}-#{@month}-#{@day}'") end extend Rote::Format::HTML @page_filters.insert(0, Rote::Filters::RedCloth.new) layout('post_mini') end |
Instance Attribute Details
#day ⇒ Object (readonly)
Returns the value of attribute day.
26 27 28 |
# File 'lib/rog/post.rb', line 26 def day @day end |
#month ⇒ Object (readonly)
Returns the value of attribute month.
26 27 28 |
# File 'lib/rog/post.rb', line 26 def month @month end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
26 27 28 |
# File 'lib/rog/post.rb', line 26 def year @year end |
Instance Method Details
#<=>(other) ⇒ Object
61 62 63 |
# File 'lib/rog/post.rb', line 61 def <=>(other) [@year, @month, @day] <=> [other.year, other.month, other.day] end |
#date ⇒ Object
57 58 59 |
# File 'lib/rog/post.rb', line 57 def date "#{@year}-#{@month}-#{@day}" end |
#path ⇒ Object
49 50 51 |
# File 'lib/rog/post.rb', line 49 def path @page_path end |
#tags ⇒ Object
45 46 47 |
# File 'lib/rog/post.rb', line 45 def @page_tags end |
#url ⇒ Object
53 54 55 |
# File 'lib/rog/post.rb', line 53 def url @page_url end |