Class: HTMLProofer::SortedIssues
- Inherits:
- 
      Object
      
        - Object
- HTMLProofer::SortedIssues
 
- Defined in:
- lib/html-proofer/issue.rb
Instance Attribute Summary collapse
- 
  
    
      #issues  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute issues. 
Instance Method Summary collapse
- 
  
    
      #initialize(issues, error_sort, logger)  ⇒ SortedIssues 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of SortedIssues. 
- #report(sorted_issues, first_report, second_report) ⇒ Object
- #sort(first_sort, second_sort) ⇒ Object
- #sort_and_report ⇒ Object
Constructor Details
#initialize(issues, error_sort, logger) ⇒ SortedIssues
Returns a new instance of SortedIssues.
| 20 21 22 23 24 | # File 'lib/html-proofer/issue.rb', line 20 def initialize(issues, error_sort, logger) @issues = issues @error_sort = error_sort @logger = logger end | 
Instance Attribute Details
#issues ⇒ Object (readonly)
Returns the value of attribute issues.
| 18 19 20 | # File 'lib/html-proofer/issue.rb', line 18 def issues @issues end | 
Instance Method Details
#report(sorted_issues, first_report, second_report) ⇒ Object
| 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | # File 'lib/html-proofer/issue.rb', line 44 def report(sorted_issues, first_report, second_report) matcher = nil sorted_issues.each do |issue| if matcher != issue.send(first_report) @logger.log :error, "- #{issue.send(first_report)}" matcher = issue.send(first_report) end if first_report == :status @logger.log :error, " * #{issue}" else @logger.log :error, " * #{issue.send(second_report)}#{issue.line}" end end end | 
#sort(first_sort, second_sort) ⇒ Object
| 40 41 42 | # File 'lib/html-proofer/issue.rb', line 40 def sort(first_sort, second_sort) issues.sort_by { |t| [t.send(first_sort), t.send(second_sort)] } end | 
#sort_and_report ⇒ Object
| 26 27 28 29 30 31 32 33 34 35 36 37 38 | # File 'lib/html-proofer/issue.rb', line 26 def sort_and_report case @error_sort when :path sorted_issues = sort(:path, :desc) report(sorted_issues, :path, :desc) when :desc sorted_issues = sort(:desc, :path) report(sorted_issues, :desc, :path) when :status sorted_issues = sort(:status, :path) report(sorted_issues, :status, :path) end end |