Class: Bringit::BlobSnippet

Inherits:
Object
  • Object
show all
Includes:
Linguist::BlobHelper
Defined in:
lib/bringit/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.



10
11
12
# File 'lib/bringit/blob_snippet.rb', line 10

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.



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

def filename
  @filename
end

#linesObject

Returns the value of attribute lines.



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

def lines
  @lines
end

#refObject

Returns the value of attribute ref.



5
6
7
# File 'lib/bringit/blob_snippet.rb', line 5

def ref
  @ref
end

#startlineObject

Returns the value of attribute startline.



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

def startline
  @startline
end

Instance Method Details

#dataObject



14
15
16
# File 'lib/bringit/blob_snippet.rb', line 14

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

#modeObject



26
27
28
# File 'lib/bringit/blob_snippet.rb', line 26

def mode
  nil
end

#nameObject



18
19
20
# File 'lib/bringit/blob_snippet.rb', line 18

def name
  filename
end

#sizeObject



22
23
24
# File 'lib/bringit/blob_snippet.rb', line 22

def size
  data.length
end