Class: Retter::Preprint

Inherits:
Object
  • Object
show all
Includes:
Retter::Page::Base
Defined in:
lib/retter/preprint.rb

Defined Under Namespace

Classes: ViewContext

Instance Attribute Summary

Attributes included from Retter::Page::Base

#path_prefix, #title

Instance Method Summary collapse

Methods included from Retter::Page::Base

#initialize

Methods included from Site

#config, #entries, #load, #reset!

Methods included from Configurable

#configurable, #define_configurable_method, #define_instance_shortcut_method

Instance Method Details

#bind(entry) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/retter/preprint.rb', line 23

def bind(entry)
  context = ViewContext.new(entry)
  part    = Tilt.new(
    template_path.to_path,
    ugly: true,
    filename: template_path.to_path
  ).render(context)

  print part
end

#pathObject



15
16
17
# File 'lib/retter/preprint.rb', line 15

def path
  config.retter_home.join '.preview.html'
end

#template_pathObject



19
20
21
# File 'lib/retter/preprint.rb', line 19

def template_path
  Page.find_template_path('entry')
end