Sha256: d3250266b38165e386ed3e781051daa8e048def2a7887eff8aeca7e2e6dd7ef0

Contents?: true

Size: 786 Bytes

Versions: 52

Compression:

Stored size: 786 Bytes

Contents

# Copyright (C) the Rugged contributors.  All rights reserved.
#
# This file is part of Rugged, distributed under the MIT license.
# For full terms see the included LICENSE file.

module Rugged
  class Blob
    class HashSignature
      WHITESPACE_DEFAULT  = 0
      WHITESPACE_IGNORE   = 1
      WHITESPACE_SMART    = 2
    end

    def hashsig(options = 0)
      @hashsig ||= HashSignature.new(self, options)
    end

    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
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
rugged-1.9.0 lib/rugged/blob.rb
rugged-1.7.2 lib/rugged/blob.rb
rugged-1.6.5 lib/rugged/blob.rb
rugged-1.7.1 lib/rugged/blob.rb
rugged-1.6.3 lib/rugged/blob.rb
rugged-1.6.2 lib/rugged/blob.rb
rugged-1.5.1 lib/rugged/blob.rb
rugged-1.4.5 lib/rugged/blob.rb
rugged-1.5.0.1 lib/rugged/blob.rb
rugged-1.5.0 lib/rugged/blob.rb
rugged-1.3.2.3 lib/rugged/blob.rb
rugged-1.4.4 lib/rugged/blob.rb
rugged-1.3.2.1 lib/rugged/blob.rb
rugged-1.4.3 lib/rugged/blob.rb
rugged-1.3.2 lib/rugged/blob.rb
rugged-1.4.2 lib/rugged/blob.rb
rugged-1.3.1 lib/rugged/blob.rb
rugged-1.3.0 lib/rugged/blob.rb
rugged-1.2.0 lib/rugged/blob.rb
rugged-1.1.1 lib/rugged/blob.rb