Module: SourceRoute::Formats::Html

Defined in:
lib/source_route/formats/html.rb

Class Method Summary collapse

Class Method Details

.slim_render(results) ⇒ Object

results is instance of Wrapper



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/source_route/formats/html.rb', line 9

def self.slim_render(results)
  template_path = File.expand_path "../html_template.slim", __FILE__
  slim_template = Slim::Template.new(template_path)

  filename = results.condition.result_config[:filename] ||
    "#{Time.now.strftime('%H%M')}-source-route.html"
  html_output_str = slim_template.render(results)
  File.open(filename, 'w') do |f|
    f << html_output_str
  end
end