Module: HQMF2JS::Generator

Defined in:
lib/generator/js.rb,
lib/generator/execution.rb,
lib/generator/codes_to_json.rb

Defined Under Namespace

Classes: CodesToJson, Counter, ErbContext, Execution, FunctionCounter, JS, TemplateCounter

Class Method Summary collapse

Class Method Details

.render_template(name, params) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/generator/js.rb', line 4

def self.render_template(name, params)
  template_path = File.expand_path(File.join('..', "#{name}.js.erb"), __FILE__)
  template_str = File.read(template_path)
  template = ERB.new(template_str, nil, '-', "_templ#{TemplateCounter.instance.new_id}")
  context = ErbContext.new(params)
  template.result(context.get_binding)        
end