Class: Gumbo::TemplateFile
Instance Attribute Summary
Attributes inherited from AssetFile
#context, #name, #output_dir, #source_dir
Instance Method Summary
collapse
Methods inherited from AssetFile
class_for, #eql?, ext, for, #hash, #initialize, #logger, #replace_ext, #should_be_rebuilt?, #source_file
Instance Method Details
#build ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/gumbo/template_file.rb', line 8
def build
logger.info "#{source_file} -> #{output_file}"
mkdir_p File.dirname(output_file)
open(output_file, 'w') do |out|
parse(File.read(source_file))
out << render(context)
end
end
|
#output_file ⇒ Object
4
5
6
|
# File 'lib/gumbo/template_file.rb', line 4
def output_file
@output_file ||= super.sub(/\.liquid$/,'')
end
|
#parse(src) ⇒ Object
17
18
19
|
# File 'lib/gumbo/template_file.rb', line 17
def parse(src)
raise NotImplementedError
end
|
#render(context) ⇒ Object
21
22
23
|
# File 'lib/gumbo/template_file.rb', line 21
def render(context)
raise NotImplementedError
end
|