Sha256: b8991b5128af47174442db768cc02d249ade6e37b2c51934b17e22c33052a0dc

Contents?: true

Size: 540 Bytes

Versions: 4

Compression:

Stored size: 540 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.read(2**10)
        digest.update(data)
      end
    end
    digest.hexdigest
  end

end

class Pathname
  include Nanoc3::PathnameExtensions
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nanoc3-3.2.4 lib/nanoc3/base/core_ext/pathname.rb
nanoc3-3.2.3 lib/nanoc3/base/core_ext/pathname.rb
nanoc3-3.2.2 lib/nanoc3/base/core_ext/pathname.rb
nanoc3-3.2.1 lib/nanoc3/base/core_ext/pathname.rb