module Shrine::Plugins::Signature::ClassMethods

  1. lib/shrine/plugins/signature.rb

Methods

Public Instance

  1. calculate_signature

Public Instance Aliases

signature -> calculate_signature

Public Instance methods

calculate_signature(io, algorithm, format: :hex, rewind: true)

Calculates algorithm hash of the contents of the IO object, and encodes it into format.

[show source]
   # File lib/shrine/plugins/signature.rb
24 def calculate_signature(io, algorithm, format: :hex, rewind: true)
25   calculator = SignatureCalculator.new(algorithm.downcase, format: format)
26 
27   signature = instrument_signature(io, algorithm, format) { calculator.call(io) }
28   io.rewind if rewind
29 
30   signature
31 end