Module: Templight

Defined in:
lib/templight.rb,
lib/templight/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.configure(options = {:path => @template_path}) ⇒ Object



14
15
16
# File 'lib/templight.rb', line 14

def self.configure(options={:path => @template_path})
  @template_path = options[:path]
end

.render(filename, args) ⇒ Object



18
19
20
21
22
23
# File 'lib/templight.rb', line 18

def self.render(filename, args)
  template_string = File.read(File.join(@template_path, filename))
  template = ERB.new template_string
  params = ErbBinding.new(args)
  return template.result(params.get_binding)
end