Class: Gumbo::TemplateFile

Inherits:
AssetFile show all
Defined in:
lib/gumbo/template_file.rb

Direct Known Subclasses

LiquidFile

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

Constructor Details

This class inherits a constructor from Gumbo::AssetFile

Instance Method Details

#buildObject



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_fileObject



4
5
6
# File 'lib/gumbo/template_file.rb', line 4

def output_file
  @output_file ||= super.sub(/\.liquid$/,'')
end

#parse(src) ⇒ Object

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/gumbo/template_file.rb', line 17

def parse(src)
  raise NotImplementedError
end

#render(context) ⇒ Object

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/gumbo/template_file.rb', line 21

def render(context)
  raise NotImplementedError
end