class SuperDiff::TieredLinesFormatter::FormattableLine

Constants

COLORS
ICONS
INDENTATION_UNIT

Public Instance Methods

color() click to toggle source
# 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
content() click to toggle source
# File lib/super_diff/tiered_lines_formatter.rb, line 42
def content
  icon + " " + indentation + line.prefix + line.value + possible_comma
end

Private Instance Methods

icon() click to toggle source
# File lib/super_diff/tiered_lines_formatter.rb, line 57
def icon
  ICONS.fetch(line.type) do
    raise(
      KeyError,
      "Couldn't find icon for line type #{line.type.inspect}!",
    )
  end
end
indentation() click to toggle source
# File lib/super_diff/tiered_lines_formatter.rb, line 66
def indentation
  INDENTATION_UNIT * line.indentation_level
end
possible_comma() click to toggle source
# File lib/super_diff/tiered_lines_formatter.rb, line 70
def possible_comma
  if line.add_comma?
    ","
  else
    ""
  end
end