Class: Guideline::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/guideline/renderer.rb

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ Renderer

Returns a new instance of Renderer.



5
6
7
# File 'lib/guideline/renderer.rb', line 5

def initialize(errors)
  @errors = errors
end

Instance Method Details

#detailObject



9
10
11
12
13
14
15
16
# File 'lib/guideline/renderer.rb', line 9

def detail
  "".tap do |result|
    errors_by_path.each do |path, errors|
      result << "\n#{path}\n"
      errors.sort_by(&:line).each {|error| result << "#{error.render}\n" }
    end
  end
end

#summaryObject



18
19
20
21
22
23
24
# File 'lib/guideline/renderer.rb', line 18

def summary
  "".tap do |result|
    error_summary.each do |name, count|
      result << "#{name}: #{count}\n"
    end
  end
end