Class: Licensee::FilesystemRepository::Blob

Inherits:
Struct
  • Object
show all
Defined in:
lib/licensee/filesystem_repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentObject

Returns the value of attribute content



22
23
24
# File 'lib/licensee/filesystem_repository.rb', line 22

def content
  @content
end

Instance Method Details

#hashsig(options = 0) ⇒ Object



31
32
33
34
35
# File 'lib/licensee/filesystem_repository.rb', line 31

def hashsig(options = 0)
  @hashsig ||= Rugged::Blob::HashSignature.new(content, options)
rescue Rugged::InvalidError
  nil
end

#similarity(other) ⇒ Object



27
28
29
# File 'lib/licensee/filesystem_repository.rb', line 27

def similarity(other)
  self.hashsig ? Rugged::Blob::HashSignature.compare(self.hashsig, other) : 0
end

#sizeObject



23
24
25
# File 'lib/licensee/filesystem_repository.rb', line 23

def size
  content.size
end