Sha256: d8e51379d7620e056559c96e399a394228de3d3f8434f9ac5309ae1cae650e6f
Contents?: true
Size: 718 Bytes
Versions: 1
Compression:
Stored size: 718 Bytes
Contents
require 'digest/sha2' module Hanko class Fingerprint class << self attr_writer :digest_class def pon(assets_dir, source) cached_pon[source] ||= generate_pon(assets_dir, source) end def digest_class=(klass) @cached_pon = {} @digest_class = klass end private def cached_pon @cached_pon ||= {} end def generate_pon(assets_dir, source) path = File.join(assets_dir || '', source) File.exist?(path) ? file_digest(path) : '' end def file_digest(path) digest_class.file(path).hexdigest end def digest_class @digest_class || ::Digest::SHA256 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hanko-0.1.2 | lib/hanko/fingerprint.rb |