Class: Elasticsearch::Git::LiteBlob

Inherits:
Object
  • Object
show all
Includes:
EncoderHelper, Linguist::BlobHelper
Defined in:
lib/elasticsearch/git/lite_blob.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo, raw_blob_hash) ⇒ LiteBlob

Returns a new instance of LiteBlob.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/elasticsearch/git/lite_blob.rb', line 12

def initialize(repo, raw_blob_hash)
  @id   = raw_blob_hash[:oid]

  blob  = repo.lookup(@id)

  @mode = raw_blob_hash[:mode].to_s(8)
  @size = blob.size
  @path = encode!(raw_blob_hash[:path])
  @name = @path.split('/').last
  @data = encode!(blob.content)
end

Instance Attribute Details

#commit_idObject

Returns the value of attribute commit_id.



10
11
12
# File 'lib/elasticsearch/git/lite_blob.rb', line 10

def commit_id
  @commit_id
end

#dataObject

Returns the value of attribute data.



10
11
12
# File 'lib/elasticsearch/git/lite_blob.rb', line 10

def data
  @data
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/elasticsearch/git/lite_blob.rb', line 10

def id
  @id
end

#modeObject

Returns the value of attribute mode.



10
11
12
# File 'lib/elasticsearch/git/lite_blob.rb', line 10

def mode
  @mode
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/elasticsearch/git/lite_blob.rb', line 10

def name
  @name
end

#pathObject

Returns the value of attribute path.



10
11
12
# File 'lib/elasticsearch/git/lite_blob.rb', line 10

def path
  @path
end

#sizeObject

Returns the value of attribute size.



10
11
12
# File 'lib/elasticsearch/git/lite_blob.rb', line 10

def size
  @size
end