Module: Dapp::Helper::Sha256
- Included in:
- Dapp, Dimg::Build::Stage::Base, Dimg::Dimg
- Defined in:
- lib/dapp/helper/sha256.rb
Instance Method Summary collapse
Instance Method Details
#hashsum(arg) ⇒ Object
4 5 6 |
# File 'lib/dapp/helper/sha256.rb', line 4 def hashsum(arg) sha256(arg) end |
#paths_content_hashsum(paths) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/dapp/helper/sha256.rb', line 8 def paths_content_hashsum(paths) paths.map(&:to_s) .reject { |path| File.directory?(path) } .sort .reduce(nil) { |hash, path| hashsum [hash, File.read(path)].compact } end |
#sha256(arg) ⇒ Object
15 16 17 |
# File 'lib/dapp/helper/sha256.rb', line 15 def sha256(arg) Digest::SHA256.hexdigest Array(arg).flatten.compact.map(&:to_s).join(':::') end |