summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff/line.rb
blob: 03730b435adc5fdceaf404198ee07ccf9da58ace (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Gitlab
  module Diff
    class Line
      attr_reader :type, :index, :old_pos, :new_pos
      attr_accessor :text

      def initialize(text, type, index, old_pos, new_pos)
        @text, @type, @index = text, type, index
        @old_pos, @new_pos = old_pos, new_pos
      end

      def added?
        type == 'new'
      end

      def removed?
        type == 'old'
      end
    end
  end
end