lib/licensee/license_file.rb in licensee-4.3.3 vs lib/licensee/license_file.rb in licensee-4.4.0
- old
+ new
@@ -2,10 +2,16 @@
class LicenseFile
attr_reader :blob
def initialize(blob)
@blob = blob
+ end
+
+ def similarity(other)
blob.hashsig(Rugged::Blob::HashSignature::WHITESPACE_SMART)
+ other.hashsig ? blob.similarity(other.hashsig) : 0
+ rescue Rugged::InvalidError
+ 0
end
# Raw file contents
def content
@contents ||= begin