Class: Rcov::HTMLCoverage
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Rcov::HTMLCoverage
- Includes:
- XX::XHTML, XX::XMLish
- Defined in:
- lib/rcov/formatters/html_coverage.rb
Overview
:nodoc:
Direct Known Subclasses
Defined Under Namespace
Classes: SummaryFileInfo
Constant Summary collapse
- JAVASCRIPT_PROLOG =
"\n // <![CDATA[\n function toggleCode( id ) {\nif ( document.getElementById )\n elem = document.getElementById( id );\nelse if ( document.all )\n elem = eval( \"document.all.\" + id );\nelse\n return false;\n\nelemStyle = elem.style;\n\nif ( elemStyle.display != \"block\" ) {\n elemStyle.display = \"block\"\n} else {\n elemStyle.display = \"none\"\n}\n\nreturn true;\n }\n\n // Make cross-references hidden by default\n document.writeln( \"<style type=\\\\\"text/css\\\\\">span.cross-ref { display: none }</style>\" )\n // ]]>\n"
- CSS_PROLOG =
"span.cross-ref-title {\n font-size: 140%;\n}\nspan.cross-ref a {\n text-decoration: none;\n}\nspan.cross-ref {\n background-color:#f3f7fa;\n border: 1px dashed #333;\n margin: 1em;\n padding: 0.5em;\n overflow: hidden;\n}\na.crossref-toggle {\n text-decoration: none;\n}\nspan.marked0 {\n background-color: rgb(185, 210, 200);\n display: block;\n}\nspan.marked1 {\n background-color: rgb(190, 215, 205);\n display: block;\n}\nspan.inferred0 {\n background-color: rgb(255, 255, 240);\n display: block;\n}\nspan.inferred1 {\n background-color: rgb(255, 255, 240);\n display: block;\n}\nspan.uncovered0 {\n background-color: rgb(225, 110, 110);\n display: block;\n}\nspan.uncovered1 {\n background-color: rgb(235, 120, 120);\n display: block;\n}\nspan.overview {\n border-bottom: 8px solid black;\n}\ndiv.overview {\n border-bottom: 8px solid black;\n}\nbody {\n font-family: verdana, arial, helvetica;\n}\n\ndiv.footer {\n font-size: 68%;\n margin-top: 1.5em;\n}\n\nh1, h2, h3, h4, h5, h6 {\n margin-bottom: 0.5em;\n}\n\nh5 {\n margin-top: 0.5em;\n}\n\n.hidden {\n display: none;\n}\n\ndiv.separator {\n height: 10px;\n}\n/* Commented out for better readability, esp. on IE */\n/*\ntable tr td, table tr th {\n font-size: 68%;\n}\n\ntd.value table tr td {\n font-size: 11px;\n}\n*/\n\ntable.percent_graph {\n height: 12px;\n border: #808080 1px solid;\n empty-cells: show;\n}\n\ntable.percent_graph td.covered {\n height: 10px;\n background: #00f000;\n}\n\ntable.percent_graph td.uncovered {\n height: 10px;\n background: #e00000;\n}\n\ntable.percent_graph td.NA {\n height: 10px;\n background: #eaeaea;\n}\n\ntable.report {\n border-collapse: collapse;\n width: 100%;\n}\n\ntable.report td.heading {\n background: #dcecff;\n border: #d0d0d0 1px solid;\n font-weight: bold;\n text-align: center;\n}\n\ntable.report td.heading:hover {\n background: #c0ffc0;\n}\n\ntable.report td.text {\n border: #d0d0d0 1px solid;\n}\n\ntable.report td.value,\ntable.report td.lines_total,\ntable.report td.lines_code {\n text-align: right;\n border: #d0d0d0 1px solid;\n}\ntable.report tr.light {\n background-color: rgb(240, 240, 245);\n}\ntable.report tr.dark {\n background-color: rgb(230, 230, 235);\n}\n"
- DEFAULT_OPTS =
{:color => false, :fsr => 30, :destdir => "coverage", :callsites => false, :cross_references => false, :validator_links => true, :charset => nil }
Constants included from XX::Markup
XX::Markup::XX_MARKUP_RECURSIVE_INCLUSION_PROC
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(opts = {}) ⇒ HTMLCoverage
constructor
A new instance of HTMLCoverage.
Methods included from XX::XMLish
Methods included from XX::Markup
Methods included from XX::Markup::ClassMethods
#xx_ancestors, #xx_config, #xx_config_for, #xx_configure, #xx_define_tag_method, #xx_define_tmp_method, #xx_remove_tag_method, #xx_tag_method_name
Methods included from XX::Markup::InstanceMethods
#method_missing, #xx_ancestors, #xx_any_, #xx_cdata_, #xx_class, #xx_config, #xx_config_for, #xx_configure, #xx_define_tag_method, #xx_define_tmp_method, #xx_doc, #xx_markup_, #xx_parse_attributes, #xx_parse_yaml_attributes, #xx_remove_tag_method, #xx_tag_, #xx_tag_method_name, #xx_text_, #xx_which, #xx_with_doc_in_effect
Methods included from XX::XHTML
Methods inherited from BaseFormatter
#add_file, #code_coverage, #each_file_pair_sorted, #mangle_filename, #normalize_filename, #num_code_lines, #num_lines, #sorted_file_pairs, #total_coverage
Constructor Details
#initialize(opts = {}) ⇒ HTMLCoverage
Returns a new instance of HTMLCoverage.
176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/rcov/formatters/html_coverage.rb', line 176 def initialize(opts = {}) = DEFAULT_OPTS.clone.update(opts) super() @dest = [:destdir] @color = [:color] @fsr = [:fsr] @do_callsites = [:callsites] @do_cross_references = [:cross_references] @span_class_index = 0 @show_validator_links = [:validator_links] @charset = [:charset] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class XX::Markup::InstanceMethods
Instance Method Details
#execute ⇒ Object
189 190 191 192 193 194 195 196 197 |
# File 'lib/rcov/formatters/html_coverage.rb', line 189 def execute return if @files.empty? FileUtils.mkdir_p @dest create_index(File.join(@dest, "index.html")) each_file_pair_sorted do |filename, fileinfo| create_file(File.join(@dest, mangle_filename(filename)), fileinfo) end end |