class Shrine::Plugins::Signature::SignatureCalculator
Constants
- SUPPORTED_ALGORITHMS
- SUPPORTED_FORMATS
Attributes
Public Class Methods
Source
# File lib/shrine/plugins/signature.rb 58 def initialize(algorithm, format:) 59 raise Error, "unknown hash algorithm #{algorithm.inspect}, supported algorithms are: #{SUPPORTED_ALGORITHMS.join(",")}" unless SUPPORTED_ALGORITHMS.include?(algorithm) 60 raise Error, "unknown hash format #{format.inspect}, supported formats are: #{SUPPORTED_FORMATS.join(",")}" unless SUPPORTED_FORMATS.include?(format) 61 62 @algorithm = algorithm 63 @format = format 64 end
Public Instance Methods
Source
# File lib/shrine/plugins/signature.rb 66 def call(io) 67 hash = send(:"calculate_#{algorithm}", io) 68 send(:"encode_#{format}", hash) 69 end