class SemiStatic::Page
Attributes
body[RW]
slug[W]
title[RW]
Public Class Methods
all()
click to toggle source
# File lib/semi_static/page.rb, line 13 def self.all SemiStatic.backend.all(self) end
find(param)
click to toggle source
# File lib/semi_static/page.rb, line 21 def self.find(param) param = CGI.unescape(param) if param =~ /%/ all.find {|a| a.to_param == param } end
first()
click to toggle source
# File lib/semi_static/page.rb, line 17 def self.first all.first end
new(body, args)
click to toggle source
# File lib/semi_static/page.rb, line 26 def initialize(body, args) @body = body args.each_pair do |k,v| send("#{k}=", v) end end
Public Instance Methods
persisted?()
click to toggle source
# File lib/semi_static/page.rb, line 49 def persisted? true end
render(source)
click to toggle source
# File lib/semi_static/page.rb, line 45 def render(source) body.render(source).html_safe end
slug()
click to toggle source
# File lib/semi_static/page.rb, line 37 def slug @slug || title.to_slug.normalize.to_s.gsub("!", "") end
to_param()
click to toggle source
# File lib/semi_static/page.rb, line 33 def to_param slug end
to_s()
click to toggle source
# File lib/semi_static/page.rb, line 41 def to_s title.to_s end