Class: CC::Analyzer::Formatters::HTMLFormatter::ReportTemplate
- Inherits:
-
Object
- Object
- CC::Analyzer::Formatters::HTMLFormatter::ReportTemplate
- Includes:
- ERB::Util
- Defined in:
- lib/cc/analyzer/formatters/html_formatter.rb
Constant Summary collapse
- TEMPLATE_PATH =
File.(File.join(File.dirname(__FILE__), "templates/html.erb"))
Instance Attribute Summary collapse
-
#issues ⇒ Object
readonly
Returns the value of attribute issues.
Instance Method Summary collapse
-
#initialize(issues, filesystem) ⇒ ReportTemplate
constructor
A new instance of ReportTemplate.
- #param(str) ⇒ Object
- #params(values) ⇒ Object
- #project_name ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(issues, filesystem) ⇒ ReportTemplate
Returns a new instance of ReportTemplate.
364 365 366 367 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 364 def initialize(issues, filesystem) @issues = issues @filesystem = filesystem end |
Instance Attribute Details
#issues ⇒ Object (readonly)
Returns the value of attribute issues.
360 361 362 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 360 def issues @issues end |
Instance Method Details
#param(str) ⇒ Object
378 379 380 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 378 def param(str) str.downcase.gsub(/\s+/, "-") end |
#params(values) ⇒ Object
382 383 384 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 382 def params(values) values.map { |c| param c }.join(" ") end |
#project_name ⇒ Object
374 375 376 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 374 def project_name File.basename(filesystem.root) end |
#render ⇒ Object
369 370 371 372 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 369 def render template = File.read(TEMPLATE_PATH) ERB.new(template, nil, "-").result(binding) end |