Sha256: 1f4b886b7bbedb2da52a9c9d32b7743c29065e50ee7acff772c5b5551fd92f99

Contents?: true

Size: 547 Bytes

Versions: 5

Compression:

Stored size: 547 Bytes

Contents

# encoding: utf-8

module Nanoc3::PathnameExtensions

  # Calculates the checksum for the file referenced to by this pathname. Any
  # change to the file contents will result in a different checksum.
  #
  # @return [String] The checksum for this file
  #
  # @api private
  def checksum
    digest = Digest::SHA1.new
    File.open(self.to_s, 'r') do |io|
      until io.eof
        data = io.readpartial(2**10)
        digest.update(data)
      end
    end
    digest.hexdigest
  end

end

class Pathname
  include Nanoc3::PathnameExtensions
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nanoc3-3.2.0 lib/nanoc3/base/core_ext/pathname.rb
nanoc3-3.2.0b3 lib/nanoc3/base/core_ext/pathname.rb
nanoc3-3.2.0b2 lib/nanoc3/base/core_ext/pathname.rb
nanoc3-3.2.0b1 lib/nanoc3/base/core_ext/pathname.rb
nanoc3-3.2.0a4 lib/nanoc3/base/core_ext/pathname.rb