Sha256: c41c612b52d0433bc0b46bbe0c513b42a91823aee16f545ce8f007f2901393c3
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
require 'digest/sha2' module Hanko class Fingerprint class << self attr_writer :digest_class, :cachable def pon(assets_dir, source) if cachable? cached_pon[source] ||= generate_pon(assets_dir, source) else generate_pon(assets_dir, source) end 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.file?(path) ? file_digest(path) : '' end def file_digest(path) digest_class.file(path).hexdigest end def digest_class @digest_class || ::Digest::SHA256 end def cachable? @cachable != false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hanko-0.1.5 | lib/hanko/fingerprint.rb |