Sha256: 24577003de7ec9460659c66376ddb05c01d4dec877f01a546ffe43cf7bf5b920
Contents?: true
Size: 659 Bytes
Versions: 35
Compression:
Stored size: 659 Bytes
Contents
require 'digest' module Ecoportal module API module Common module Content module StringDigest MAX_HASH_LABEL = 64 def indexable_label(str) return nil unless str lbl = str.downcase.gsub(/[^A-Za-z]+/,"-").slice(0, MAX_HASH_LABEL) return nil unless lbl.length >= 3 lbl end # Calculates the Hash of the field based on label def hash_label(str) return nil unless lbl = indexable_label(str) "z" + Digest::MD5.hexdigest(lbl).slice(0, 8); end end end end end end
Version data entries
35 entries across 35 versions & 2 rubygems