class Diffux::SnapshotComparisonImage::Gutter

This class renders a gutter-column with a color representing the type of change that has happened.

Constants

GRAY
WIDTH

Public Instance Methods

render_row(y, row) click to toggle source
# File lib/diffux_core/snapshot_comparison_image/gutter.rb, line 9
def render_row(y, row)
  WIDTH.times do |x|
    render_pixel(x, y, gutter_color(row))
  end
  # render a two-pixel empty column
  2.times do |x|
    render_pixel(WIDTH - 1 - x, y, WHITE)
  end
end

Private Instance Methods

gutter_color(row) click to toggle source
# File lib/diffux_core/snapshot_comparison_image/gutter.rb, line 21
def gutter_color(row)
  if row.unchanged?
    WHITE
  elsif row.deleting?
    RED
  elsif row.adding?
    GREEN
  else # changed?
    GRAY
  end
end