Method: Rugged::Blob#similarity

Defined in:
lib/rugged/blob.rb

#similarity(other) ⇒ Object


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rugged/blob.rb', line 18

def similarity(other)
  other_sig = case other
  when HashSignature
    other
  when String
    HashSignature.new(other)
  when Blob
    other.hashsig
  else
    raise TypeError, "Expected a Rugged::Blob, String or Rugged::Blob::HashSignature"
  end

  HashSignature.compare(self.hashsig, other_sig)
end