module Gibier::HamlHelper

Public Instance Methods

convert_html(haml_file, html_file, **instance_vars) click to toggle source
# File lib/gibier/haml_helper.rb, line 3
def convert_html(haml_file, html_file, **instance_vars)
  File.open(html_file, "w") do |f|
    engine = Haml::Engine.new(File.read(haml_file))
    context = Object.new
    instance_vars.each do |key, value|
      context.instance_variable_set(:"@#{key}", value)
    end
    f.write engine.render(context) # Tilt::StringTemplate.new().render
  end
end