Method: Webby::Renderer.write

Defined in:
lib/webby/renderer.rb

.write(page) ⇒ Object

call-seq:

Renderer.write( page )

Render the given page and write the resulting output to the page’s destination. If the page uses pagination, then multiple destination files will be created – one for each paginated data set in the page.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/webby/renderer.rb', line 35

def self.write( page )
  renderer = self.new(page)

  loop {
    FileUtils.mkdir_p ::File.dirname(page.destination)
    journal.create_or_update(page)

    text = renderer._layout_page
    unless text.nil?
      ::File.open(page.destination, 'w') {|fd| fd.write(text)}
    end

    break unless renderer._next_page
  }
end