class Grit::DiffLine

Public Class Methods

status_from_char(char) click to toggle source
# File lib/grit/ext/diff_line.rb, line 15
def self.status_from_char(char)
  case char
  when '+' then :added
  when '-' then :removed
  when ' ' then :unchanged
  else
    nil
  end
end

Public Instance Methods

added?() click to toggle source
# File lib/grit/ext/diff_line.rb, line 3
def added?
  status == :added
end
removed?() click to toggle source
# File lib/grit/ext/diff_line.rb, line 7
def removed?
  status == :removed
end
to_s() click to toggle source
# File lib/grit/ext/diff_line.rb, line 25
def to_s
  "#{char_from_status}#{content}"
end
unchanged?() click to toggle source
# File lib/grit/ext/diff_line.rb, line 11
def unchanged?
  status == :unchanged
end

Private Instance Methods

char_from_status() click to toggle source
# File lib/grit/ext/diff_line.rb, line 31
def char_from_status
  case status
  when :added then '+'
  when :removed then '-'
  when :unchanged then ' '
  end
end