Module: Shrine::Plugins::Signature::ClassMethods

Defined in:
lib/shrine/plugins/signature.rb

Instance Method Summary collapse

Instance Method Details

#calculate_signature(io, algorithm, format: :hex) ⇒ Object Also known as: signature

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



31
32
33
34
35
# File 'lib/shrine/plugins/signature.rb', line 31

def calculate_signature(io, algorithm, format: :hex)
  instrument_signature(io, algorithm, format) do
    SignatureCalculator.new(algorithm.downcase, format: format).call(io)
  end
end