Class: CheckPlease::Printers::TablePrint

Inherits:
Base
  • Object
show all
Defined in:
lib/check_please/printers/table_print.rb

Constant Summary collapse

InspectStrings =
Object.new.tap do |obj|
  def obj.format(value)
    value.is_a?(String) ? value.inspect : value
  end
end
PATH_MAX_WIDTH =

if you hit this limit, you have other problems

250
TP_OPTS =
[
  { type:      { display_name: "Type" } },
  { path:      { display_name: "Path",      width: PATH_MAX_WIDTH } },
  { reference: { display_name: "Reference", formatters: [ InspectStrings ] } },
  { candidate: { display_name: "Candidate", formatters: [ InspectStrings ] } },
]

Instance Method Summary collapse

Methods inherited from Base

#initialize, render

Constructor Details

This class inherits a constructor from CheckPlease::Printers::Base

Instance Method Details

#to_sObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/check_please/printers/table_print.rb', line 22

def to_s
  return "" if diffs.empty?

  out = build_string do |io|
    switch_tableprint_io(io) do
      tp diffs.data, *TP_OPTS
    end
  end
  strip_trailing_whitespace(out)
end