Class: Retter::Page::Article
- Inherits:
-
Object
- Object
- Retter::Page::Article
- Includes:
- Base
- Defined in:
- lib/retter/page/article.rb
Defined Under Namespace
Classes: ViewContext
Instance Attribute Summary collapse
-
#article ⇒ Object
readonly
Returns the value of attribute article.
Attributes included from Base
Instance Method Summary collapse
- #bind ⇒ Object
-
#initialize(article) ⇒ Article
constructor
A new instance of Article.
- #path ⇒ Object
- #template_path ⇒ Object
Methods included from Site
#config, #entries, #load, #reset!
Methods included from Configurable
#configurable, #define_configurable_method, #define_instance_shortcut_method
Constructor Details
#initialize(article) ⇒ Article
Returns a new instance of Article.
18 19 20 21 22 23 |
# File 'lib/retter/page/article.rb', line 18 def initialize(article) super() @path_prefix = '../../' @article = article @title = "#{article.title} - #{config.title}" end |
Instance Attribute Details
#article ⇒ Object (readonly)
Returns the value of attribute article.
16 17 18 |
# File 'lib/retter/page/article.rb', line 16 def article @article end |
Instance Method Details
#bind ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/retter/page/article.rb', line 33 def bind context = ViewContext.new(article.entry, article) part = Tilt.new( template_path.to_path, ugly: true, filename: template_path.to_path ).render(context) print part end |
#path ⇒ Object
25 26 27 |
# File 'lib/retter/page/article.rb', line 25 def path Page.entry_dir(article.entry.date).join("#{article.id}.html") end |
#template_path ⇒ Object
29 30 31 |
# File 'lib/retter/page/article.rb', line 29 def template_path Page.find_template_path('article') end |