class Miyano::Post

Attributes

content[R]
cre_date[R]
mod_date[R]
name[R]
text[R]
title[R]
url[R]

Public Class Methods

new(name, cre_date, mod_date, title="", content="", text="", tags=[]) click to toggle source
# File lib/miyano/post.rb, line 8
def initialize(name, cre_date, mod_date, title="", content="",
               text="", tags=[])
  @name, @title = name, title
  @cre_date, @mod_date = cre_date, mod_date
  @content, @text, @tags = content, text, tags
  @url = "/#{@name}/"
end

Public Instance Methods

content_for_homepage() click to toggle source
# File lib/miyano/post.rb, line 33
def content_for_homepage
  res=@content.gsub /\=\"assets\//, %(="#{@url}assets/)
  res[(@title.length+9)..-1]
end
content_no_assets() click to toggle source
# File lib/miyano/post.rb, line 28
def content_no_assets
  res = @content.gsub /<p.*?\=\"assets\/.*?p>/, ""
  res[(@title.length+9)..-1]
end
date(format="%b %-d, %Y") click to toggle source
# File lib/miyano/post.rb, line 16
def date(format="%b %-d, %Y")
  @mod_date.strftime format
end
summary() click to toggle source
# File lib/miyano/post.rb, line 24
def summary
  @text[(@title.length+2)..-1].delete "#*"
end
tags() click to toggle source
# File lib/miyano/post.rb, line 20
def tags
  @tags
end