module GoodData::Helpers::ErbHelper

Public Class Methods

template_file(path, params) click to toggle source
# File lib/gooddata/helpers/erb_helper.rb, line 17
def template_file(path, params)
  template_string(File.read(path), params)
end
template_string(template, params = {}) click to toggle source
# File lib/gooddata/helpers/erb_helper.rb, line 7
def template_string(template, params = {})
  b = binding

  params.each do |k, v|
    b.local_variable_set(k, v)
  end

  ERB.new(template).result(b)
end