Class: Lifer::Layout

Inherits:
Object
  • Object
show all
Defined in:
lib/lifer/layout.rb

Constant Summary collapse

DEFAULT =
"%s/templates/layout.html.erb" %
File.expand_path(File.dirname(__FILE__))

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(entry:, template: DEFAULT) ⇒ Object



8
9
10
# File 'lib/lifer/layout.rb', line 8

def build(entry:, template: DEFAULT)
  new(entry: entry, template: template).render { entry.to_html }
end

Instance Method Details

#renderObject



13
14
15
# File 'lib/lifer/layout.rb', line 13

def render
  ERB.new(File.readlines(template).join).result(binding)
end