Class: Hashtastic::ListHasher

Inherits:
Object
  • Object
show all
Defined in:
lib/hashtastic/list_hasher.rb

Class Method Summary collapse

Class Method Details

.call(values, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/hashtastic/list_hasher.rb', line 5

def self.call(values, &block)
  hasher = Digest::SHA3.new(256)

  values.each do |value|
    value = block.call(value) if block

    hasher.update(value.to_s)
  end

  hasher.hexdigest
end