Class: SuperDiff::Core::TieredLinesFormatter::FormattableLine

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

Constant Summary collapse

INDENTATION_UNIT =
'  '
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



49
50
51
52
53
54
55
56
# File 'lib/super_diff/core/tiered_lines_formatter.rb', line 49

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

#contentObject



45
46
47
# File 'lib/super_diff/core/tiered_lines_formatter.rb', line 45

def content
  "#{icon} #{indentation}#{line.prefix}#{line.value}#{possible_comma}"
end