Welcome to mirror list, hosted at ThFree Co, Russian Federation.

blob_snippet.rb « git « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 68116e775c68dd1168cac372d035b9b6d5b0b7c5 (plain)
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
# Gitaly note: JV: no RPC's here.

module Gitlab
  module Git
    class BlobSnippet
      include Linguist::BlobHelper

      attr_accessor :ref
      attr_accessor :lines
      attr_accessor :filename
      attr_accessor :startline

      def initialize(ref, lines, startline, filename)
        @ref, @lines, @startline, @filename = ref, lines, startline, filename
      end

      def data
        lines&.join("\n")
      end

      def name
        filename
      end

      def size
        data.length
      end

      def mode
        nil
      end
    end
  end
end