Class: Punchlist::CliRenderer

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

Overview

Render a text format of offenses

Instance Method Summary collapse

Instance Method Details

#render(output) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/punchlist/renderer.rb', line 6

def render(output)
  lines = output.map do |offense|
    "#{offense.filename}:#{offense.line_num}: #{offense.line}"
  end
  out = lines.join("\n")
  if out.empty?
    out
  else
    out + "\n"
  end
end