Class: Tailor::Reporter
- Inherits:
 - 
      Object
      
        
- Object
 - Tailor::Reporter
 
 
- Defined in:
 - lib/tailor/reporter.rb
 
Overview
Objects of this type are responsible for sending the right data to report formatters.
Instance Attribute Summary collapse
- 
  
    
      #formatters  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute formatters.
 
Instance Method Summary collapse
- 
  
    
      #file_report(file_problems, label)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Sends the data to each @formatters to generate the report of problems for the file that was just critiqued.
 - 
  
    
      #initialize(*formats)  ⇒ Reporter 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
For each in
formats, it creates a new Tailor::Formatter::#{formatter.capitalize} object and adds it to @formatters. - 
  
    
      #summary_report(all_problems)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Sends the data to each @formatters to generate the reports of problems for all files that were just critiqued.
 
Constructor Details
#initialize(*formats) ⇒ Reporter
For each in formats, it creates a new Tailor::Formatter::#{formatter.capitalize} object and adds it to @formatters.
      13 14 15 16 17 18 19 20  | 
    
      # File 'lib/tailor/reporter.rb', line 13 def initialize(*formats) @formatters = [] formats.flatten.each do |formatter| require_relative "formatters/#{formatter}" @formatters << eval("Tailor::Formatters::#{formatter.capitalize}.new") end end  | 
  
Instance Attribute Details
#formatters ⇒ Object (readonly)
Returns the value of attribute formatters.
      6 7 8  | 
    
      # File 'lib/tailor/reporter.rb', line 6 def formatters @formatters end  | 
  
Instance Method Details
#file_report(file_problems, label) ⇒ Object
Sends the data to each @formatters to generate the report of problems for the file that was just critiqued. A problem is in the format:
{ 'path/to/file.rb' => [Problem1, Problem2, etc.]}
…where Problem1 and Problem2 are of type Problem.
      32 33 34 35 36  | 
    
      # File 'lib/tailor/reporter.rb', line 32 def file_report(file_problems, label) @formatters.each do |formatter| formatter.file_report(file_problems, label) end end  | 
  
#summary_report(all_problems) ⇒ Object
Sends the data to each @formatters to generate the reports of problems for all files that were just critiqued.
      42 43 44 45 46  | 
    
      # File 'lib/tailor/reporter.rb', line 42 def summary_report(all_problems) @formatters.each do |formatter| formatter.summary_report(all_problems) end end  |