Sha256: 1b9893f5b65ebcea697213a350294248bd1204864b6e7d91b623ea88158a2780

Contents?: true

Size: 538 Bytes

Versions: 12

Compression:

Stored size: 538 Bytes

Contents

# encoding: utf-8

module Nanoc::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 Nanoc::PathnameExtensions
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nanoc-3.4.3 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.4.2 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.4.1 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.4.0 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.3.7 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.3.6 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.3.5 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.3.4 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.3.3 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.3.2 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.3.1 lib/nanoc/base/core_ext/pathname.rb
nanoc-3.3.0 lib/nanoc/base/core_ext/pathname.rb