2017-01-04 13:43:06 -05:00
|
|
|
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
|
2017-02-07 09:16:46 -05:00
|
|
|
lines&.join("\n")
|
2017-01-04 13:43:06 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def name
|
|
|
|
filename
|
|
|
|
end
|
|
|
|
|
|
|
|
def size
|
|
|
|
data.length
|
|
|
|
end
|
|
|
|
|
|
|
|
def mode
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|