Class: Gitlab::Git::BlobSnippet

Inherits:
Object
  • Object
show all
Includes:
Linguist::BlobHelper
Defined in:
lib/gitlab_git/blob_snippet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ref, lines, startline, filename) ⇒ BlobSnippet

Returns a new instance of BlobSnippet.



11
12
13
# File 'lib/gitlab_git/blob_snippet.rb', line 11

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

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



8
9
10
# File 'lib/gitlab_git/blob_snippet.rb', line 8

def filename
  @filename
end

#linesObject

Returns the value of attribute lines.



7
8
9
# File 'lib/gitlab_git/blob_snippet.rb', line 7

def lines
  @lines
end

#refObject

Returns the value of attribute ref.



6
7
8
# File 'lib/gitlab_git/blob_snippet.rb', line 6

def ref
  @ref
end

#startlineObject

Returns the value of attribute startline.



9
10
11
# File 'lib/gitlab_git/blob_snippet.rb', line 9

def startline
  @startline
end

Instance Method Details

#dataObject



15
16
17
# File 'lib/gitlab_git/blob_snippet.rb', line 15

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

#modeObject



27
28
29
# File 'lib/gitlab_git/blob_snippet.rb', line 27

def mode
  nil
end

#nameObject



19
20
21
# File 'lib/gitlab_git/blob_snippet.rb', line 19

def name
  filename
end

#sizeObject



23
24
25
# File 'lib/gitlab_git/blob_snippet.rb', line 23

def size
  data.length
end