class HTMLLayout
Attributes
body[R]
title[R]
toc[R]
Public Class Methods
new(params, template)
click to toggle source
# File lib/review/htmllayout.rb, line 7 def initialize(params, template) @body = params['body'] @title = params['title'] @toc = params['toc'] @next = params['next'] @prev = params['prev'] @builder = params['builder'] @template = template end
Public Instance Methods
next_chapter()
click to toggle source
# File lib/review/htmllayout.rb, line 18 def next_chapter if @next.present? "<a href='#{h @next.id}.html'>#{h @builder.compile_inline @next.title}</a>" else "" end end
prev_chapter()
click to toggle source
# File lib/review/htmllayout.rb, line 26 def prev_chapter if @prev.present? "<a href='#{h @prev.id}.html'>#{h @builder.compile_inline @prev.title}</a>" else "" end end
result()
click to toggle source
# File lib/review/htmllayout.rb, line 34 def result if File.exist?(@template) return ERB.new(IO.read(@template)).result(binding) else return @src end end