class Tailor::Formatter
This is really just a base class for defining other Formatter
types.
Public Class Methods
new()
click to toggle source
# File lib/tailor/formatter.rb, line 5 def initialize @pwd = Pathname(Dir.pwd) end
Public Instance Methods
file_report(file_problems, label)
click to toggle source
This method gets called by {Tailor::Reporter} after each file is critiqued. Redefine this to do what you want for that part of your report.
# File lib/tailor/formatter.rb, line 12 def file_report(file_problems, label) # Redefine this for your formatter... end
problem_levels(problems)
click to toggle source
Gets a list of all types of problems included in the problem set.
@param [Array] problems @return [Array<Symbol>] The list of problem types.
# 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)
click to toggle source
@param [Hash<Array>] problems @param [Symbol] level The level of problem to find. @return [Array] Problem
list at the given level.
# 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)
click to toggle source
This method gets called by {Tailor::Reporter} after all files are critiqued. Redefine this to do what you want for that part of your report.
# File lib/tailor/formatter.rb, line 19 def summary_report(all_problems) # Redefine this for your formatter... end