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
Returns the value of attribute issues.
-
#issues_by_path ⇒ Object
Returns the value of attribute issues_by_path.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(issue_count, issues_by_path) ⇒ ReportTemplate
constructor
A new instance of ReportTemplate.
- #pluralize(number, noun) ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(issue_count, issues_by_path) ⇒ ReportTemplate
Returns a new instance of ReportTemplate.
14 15 16 17 18 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 14 def initialize(issue_count, issues_by_path) @template = File.read(TEMPLATE_PATH) @issues_by_path = issues_by_path @issue_count = issue_count end |
Instance Attribute Details
#issues ⇒ Object
Returns the value of attribute issues.
10 11 12 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 10 def issues @issues end |
#issues_by_path ⇒ Object
Returns the value of attribute issues_by_path.
10 11 12 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 10 def issues_by_path @issues_by_path end |
#template ⇒ Object
Returns the value of attribute template.
10 11 12 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 10 def template @template end |
Instance Method Details
#pluralize(number, noun) ⇒ Object
24 25 26 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 24 def pluralize(number, noun) "#{ActiveSupport::NumberHelper.number_to_delimited(number)} #{noun.pluralize(number)}" end |
#render ⇒ Object
20 21 22 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 20 def render ERB.new(@template).result(binding) end |