File: line.rb

package info (click to toggle)
ruby-rugged 1.9.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,752 kB
  • sloc: ansic: 8,722; ruby: 7,473; sh: 99; makefile: 5
file content (52 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Copyright (C) the Rugged contributors.  All rights reserved.
#
# This file is part of Rugged, distributed under the MIT license.
# For full terms see the included LICENSE file.

module Rugged
  class Diff
    class Line
      attr_reader :line_origin, :content, :old_lineno, :new_lineno, :content_offset

      def context?
        @line_origin == :context
      end

      def addition?
        @line_origin == :addition
      end

      def deletion?
        @line_origin == :deletion
      end

      def eof_no_newline?
        @line_origin == :eof_no_newline
      end

      def eof_newline_added?
        @line_origin == :eof_newline_added
      end

      def eof_newline_removed?
        @line_origin == :eof_newline_removed
      end

      def file_header?
        @line_origin == :file_header
      end

      def hunk_header?
        @line_origin == :hunk_header
      end

      def binary?
        @line_origin == :binary
      end

      def inspect
        "#<#{self.class.name}:#{object_id} {line_origin: #{line_origin.inspect}, content: #{content.inspect}>"
      end
    end
  end
end