Class: Browsable::Formatters::Human

Inherits:
Object
  • Object
show all
Defined in:
lib/browsable/formatters/human.rb

Overview

Pretty terminal output: findings grouped by file, then sorted by position. File paths are emitted as OSC 8 hyperlinks so modern terminals make them clickable; colour is disabled automatically when stdout is not a TTY.

Constant Summary collapse

ICONS =
{ error: "", warning: "", info: "" }.freeze

Instance Method Summary collapse

Constructor Details

#initialize(report, color: $stdout.tty?) ⇒ Human

Returns a new instance of Human.



13
14
15
16
# File 'lib/browsable/formatters/human.rb', line 13

def initialize(report, color: $stdout.tty?)
  @report = report
  @pastel = Pastel.new(enabled: color)
end

Instance Method Details

#renderObject



18
19
20
21
22
# File 'lib/browsable/formatters/human.rb', line 18

def render
  sections = [header, notes, body, skips, summary,
              controller_policies, policy_suggestion].reject(&:empty?)
  sections.join("\n")
end