Class: HashHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/liquid/hash_helper.rb

Class Method Summary collapse

Class Method Details

.numeric_hash(val) ⇒ Object



6
7
8
9
# File 'lib/liquid/hash_helper.rb', line 6

def self.numeric_hash(val)
  # Use a the first 15 bytes of a MD5 bytes - small enough to be represented as Fixnum => no garbage collection
  Digest::MD5.hexdigest(val.to_s)[0..14].to_i(16)
end