Class: Tailor::Formatter
- Inherits:
-
Object
- Object
- Tailor::Formatter
- Defined in:
- lib/tailor/formatter.rb
Overview
This is really just a base class for defining other Formatter types.
Direct Known Subclasses
Instance Method Summary collapse
-
#file_report(file_problems, label) ⇒ Object
This method gets called by Reporter after each file is critiqued.
-
#initialize ⇒ Formatter
constructor
A new instance of Formatter.
-
#problem_levels(problems) ⇒ Array<Symbol>
Gets a list of all types of problems included in the problem set.
-
#problems_at_level(problems, level) ⇒ Array
Problem list at the given level.
-
#summary_report(all_problems) ⇒ Object
This method gets called by Reporter after all files are critiqued.
Constructor Details
#initialize ⇒ Formatter
Returns a new instance of Formatter.
5 6 7 |
# File 'lib/tailor/formatter.rb', line 5 def initialize @pwd = Pathname(Dir.pwd) end |
Instance Method Details
#file_report(file_problems, label) ⇒ Object
This method gets called by Reporter after each file is critiqued. Redefine this to do what you want for that part of your report.
12 13 14 |
# File 'lib/tailor/formatter.rb', line 12 def file_report(file_problems, label) # Redefine this for your formatter... end |
#problem_levels(problems) ⇒ Array<Symbol>
Gets a list of all types of problems included in the problem set.
34 35 36 |
# File 'lib/tailor/formatter.rb', line 34 def problem_levels(problems) problems.values.flatten.collect { |v| v[:level] }.uniq end |
#problems_at_level(problems, level) ⇒ Array
Returns Problem list at the given level.
26 27 28 |
# File 'lib/tailor/formatter.rb', line 26 def problems_at_level(problems, level) problems.values.flatten.find_all { |v| v[:level] == level } end |
#summary_report(all_problems) ⇒ Object
This method gets called by Reporter after all files are critiqued. Redefine this to do what you want for that part of your report.
19 20 21 |
# File 'lib/tailor/formatter.rb', line 19 def summary_report(all_problems) # Redefine this for your formatter... end |