Class: Cuporter::Formatters::Html

Inherits:
Writer
  • Object
show all
Defined in:
lib/cuporter/formatters/html.rb

Constant Summary collapse

RHTML =
%{
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Cucumber Tags</title>
    <style type="text/css">
<%= inline_style%>
    </style>
</head>
<body>
    <div class="cuporter_header">
<div id="label">
    <h1>Cucumber Tags</h1>
</div>
    </div>
    <ul class="tag_list">
<%= HtmlNodeWriter.new.write_nodes(@report, @number_scenarios)%>
    </ul>
</body>
</html>
}

Instance Method Summary collapse

Methods inherited from Writer

#initialize

Constructor Details

This class inherits a constructor from Cuporter::Formatters::Writer

Instance Method Details

#get_bindingObject



13
14
15
# File 'lib/cuporter/formatters/html.rb', line 13

def get_binding
  binding
end

#inline_styleObject



9
10
11
# File 'lib/cuporter/formatters/html.rb', line 9

def inline_style
  File.read(File.dirname(__FILE__) + "/cuporter.css")
end

#rhtmlObject



17
18
19
# File 'lib/cuporter/formatters/html.rb', line 17

def rhtml
  ERB.new(RHTML)
end

#writeObject



21
22
23
# File 'lib/cuporter/formatters/html.rb', line 21

def write
  @output.puts rhtml.result(get_binding).reject {|line| /^\s+$/ =~ line}
end