Class: SuperDiff::TieredLinesFormatter::FormattableLine

Inherits:
Object
  • Object
show all
Defined in:
lib/super_diff/tiered_lines_formatter.rb

Constant Summary collapse

INDENTATION_UNIT =
"  ".freeze
ICONS =
{ delete: "-", insert: "+", elision: " ", noop: " " }.freeze
COLORS =
{
  delete: :expected,
  insert: :actual,
  elision: :elision_marker,
  noop: :plain,
}.freeze

Instance Method Summary collapse

Instance Method Details

#colorObject



46
47
48
49
50
51
52
53
# File 'lib/super_diff/tiered_lines_formatter.rb', line 46

def color
  COLORS.fetch(line.type) do
    raise(
      KeyError,
      "Couldn't find color for line type #{line.type.inspect}!",
    )
  end
end

#contentObject



42
43
44
# File 'lib/super_diff/tiered_lines_formatter.rb', line 42

def content
  icon + " " + indentation + line.prefix + line.value + possible_comma
end