Module: Drawer

Defined in:
lib/rspec/flaky/drawer.rb

Class Method Summary collapse

Class Method Details

.draw(diffs) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/rspec/flaky/drawer.rb', line 4

def draw diffs
  @diffs = diffs
  erb_str  = File.read(Pathes.template_path)
  result = ERB.new(erb_str, nil, '-').result(binding)
  File.open(Pathes.summary_path.join('result.html'), 'w') do |f|
    f.write(result)
  end
end

.prettify(data) ⇒ Object



13
14
15
16
17
# File 'lib/rspec/flaky/drawer.rb', line 13

def prettify(data)
  return '-' if data.nil?
  return JSON.pretty_generate(data) if data.is_a? Hash
  data
end