Module: RenderHtmlErb

Defined in:
lib/render_html_erb.rb

Instance Method Summary collapse

Instance Method Details

#render_html_template(file_path, **locals) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/render_html_erb.rb', line 4

def render_html_template(file_path, **locals)
  processed_path = process_file_path(file_path)
  file_content = File.read(processed_path)
  template = ERB.new(file_content)
  bind = binding
  locals.each do |k,v|
    bind.local_variable_set(k, v)
  end
  template.result(bind)
end