Class: Retter::Page::Entry
- Inherits:
-
Object
- Object
- Retter::Page::Entry
- Includes:
- Base
- Defined in:
- lib/retter/page/entry.rb
Defined Under Namespace
Classes: ViewContext
Instance Attribute Summary collapse
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
Attributes included from Base
Instance Method Summary collapse
- #bind ⇒ Object
-
#initialize(entry) ⇒ Entry
constructor
A new instance of Entry.
- #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(entry) ⇒ Entry
Returns a new instance of Entry.
18 19 20 21 22 23 24 |
# File 'lib/retter/page/entry.rb', line 18 def initialize(entry) super() @path_prefix = '../' @entry = entry @title = "#{entry.date} - #{config.title}" end |
Instance Attribute Details
#entry ⇒ Object (readonly)
Returns the value of attribute entry.
16 17 18 |
# File 'lib/retter/page/entry.rb', line 16 def entry @entry end |
Instance Method Details
#bind ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/retter/page/entry.rb', line 34 def bind context = ViewContext.new(entry) part = Tilt.new( template_path.to_path, ugly: true, filename: template_path.to_path ).render(context) print part end |
#path ⇒ Object
26 27 28 |
# File 'lib/retter/page/entry.rb', line 26 def path Page.entry_file(entry.date) end |
#template_path ⇒ Object
30 31 32 |
# File 'lib/retter/page/entry.rb', line 30 def template_path Page.find_template_path('entry') end |