Class: Genit::PageCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/genit/project/page_compiler.rb

Overview

Compile a single page.

Instance Method Summary collapse

Constructor Details

#initialize(working_dir, filename) ⇒ PageCompiler

Public: Constructor.

working_dir - The String working directory, where live the project. filename - The String name of the page



12
13
14
15
16
17
# File 'lib/genit/project/page_compiler.rb', line 12

def initialize working_dir, filename
  @working_dir = working_dir
  @filename = filename
  @template = XmlDocument.open(File.join(@working_dir, 'templates/main.html'))
  # @template = XmlDocument.open(File.join(@working_dir, 'templates/main.html'))
end

Instance Method Details

#compileObject

Public: Compile the page.

Returns a Nokogiri::XML document.



22
23
24
25
26
27
28
# File 'lib/genit/project/page_compiler.rb', line 22

def compile
  compile_body
  compile_head
  
  builder = ScriptBuilder.new @template
  builder.build_for_page @filename
end